DEV Community

loading...
Cover image for Understand Linux with Man(ual) Pages
RudderStack

Understand Linux with Man(ual) Pages

nocnica profile image Nočnica Fee ・2 min read

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.

Discussion (0)

pic
Editor guide