DEV Community

Cover image for The Hidden Linux Manual
Nočnica Mellifera for Heroku

Posted on

The Hidden Linux Manual

How to Seek Out --help and Man(ual) Pages

When using a new tool with lots of features, it's easy to forget which options do what, where to put arguments, etc. As far as the Linux command line is concerned, many of these tools have a --help option. If you needed to reference a program's features, you could use the man command. Let's see these in action.

I downloaded a 1985 documentary about Unix. I want to use the program ffmpeg to do some rudimentary editing. But I've forgotten where the options and arguments go! I run ffmpeg --help in a terminal. There's a lot of output, so I scrolled up.

Alt Text
The line I highlighted is called the Usage Synopsis. Anything in between square brackets is optional. "A-ha," I say, "Source options first, then output options, then the output filename goes at the end."

I only want the countdown at the beginning of the video. I'm not exactly sure which option I use to do that, so I run man ffmpeg to open the ffmpeg man (short for "manual") page.

Alt Text
And I skim through this for a while (using the arrow keys, PgUp, and PgDn) until I find what I am looking for:

Alt Text
Great, I will use the -t option with seven seconds to grab the first seven seconds of the video. I press 'q' to exit the pager, and away we go:

Alt Text
Now we can all see the utility of man pages and --help. The documentation is right at your fingertips! Skim the man pages of all the tools you use that have them---Even the simple ones like ls and mkdir.

Top comments (1)

Collapse
 
n8chz profile image
Lorraine Lee

Don't forget man's companion utility, apropos. That's how you find out what you're looking for.

One nice thing about man is that on most systems, it will display a man page as if piped through less. That means you can press (capital) G to go to the bottom of the page, which by convention is where they put the examples. I often want to fast forward past the descriptions (in computerese) of the command line options, especially when options are the really complex thing about a utility, as is the case certainly with ffmpeg. (One thing I really like is the convention at npmjs.com of "leading by example" or putting the example(s) at the top of the documentation).