Mansnip - The worst-named, most complementary man-page tool I use

1 minute read


Mansnip sounds painful, but is a frictionless tool for those "I know that I need to use tar xzvf but can't remember what most of those flags mean" situations. It basically greps man pages and returns only the flag-related info. It also has LLM-related functionality but I've sidestepped that since it is good enough for me as is. Here it is in action:

$ mansnip tar -x -z -v -f
142  Operation mode
       -x, --extract, --get
              Extract files from an archive.  Arguments are optional.  When given, they specify names of the archive members to be extracted.

443  Device selection and switching
       -f, --file=ARCHIVE
              Use archive file or device ARCHIVE.  If this option is not given, tar will first examine the environment variable `TAPE'.  If it is set, its value will be
              used  as  the  archive name.  Otherwise, tar will assume the compiled-in default.  The default value can be inspected either using the --show-defaults op‐
              tion, or at the end of the tar --help output.

              An archive name that has a colon in it specifies a file or device on a remote machine.  The part before the colon is taken as the machine name or  IP  ad‐
              dress, and the part after it as the file or device pathname, e.g.:

              --file=remotehost:/dev/sr0

              An optional username can be prefixed to the hostname, placing a @ sign between them.

              By  default, the remote host is accessed via the rsh(1) command.  Nowadays it is common to use ssh(1) instead.  You can do so by giving the following com‐
              mand line option:

              --rsh-command=/usr/bin/ssh

              The remote machine should have the rmt(8) command installed.  If its pathname does not match tar's default, you can inform tar about the correct  pathname
              using the --rmt-command option.

574  Compression options
       -z, --gzip, --gunzip, --ungzip
              Filter the archive through gzip(1).

798  Informative output
       -v, --verbose
              Verbosely list files processed.  Each instance of this option on the command line increases the verbosity level by one.  The maximum verbosity level is 3.
              For a detailed discussion of how various verbosity levels affect tar's output, please refer to GNU Tar Manual, subsection 2.5.2 "The '--verbose' Option".

A bit verbose but that's because the flag breakdown is detailed. Here's a shorter one from some popular ls flags:

$ mansnip ls -l -h -a
13     -a, --all
              do not ignore entries starting with .

45     -f     same as -a -U

       -F, --classify[=WHEN]
              append indicator (one of */=>@|) to entries WHEN

67     -h, --human-readable
              with -l and -s, print sizes like 1K 234M 2G etc.

96     -l     use a long listing format

       -L, --dereference
              when showing file information for a symbolic link, show information for the file the link references rather than for the link itself