How do I use man pages to learn how to use commands?











up vote
87
down vote

favorite
51












While researching another problem, I came across a command,



locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


that I wanted to learn more about. So I ran man xargs and get the following output:



XARGS(1)                    General Commands Manual                   XARGS(1)

NAME
xargs - build and execute command lines from standard input

SYNOPSIS
xargs [-0prtx] [-E eof-str] [-e[eof-str]] [--eof[=eof-str]] [--null]
[-d delimiter] [--delimiter delimiter] [-I replace-str] [-i[replace-
str]] [--replace[=replace-str]] [-l[max-lines]] [-L max-lines]
[--max-lines[=max-lines]] [-n max-args] [--max-args=max-args] [-s max-
chars] [--max-chars=max-chars] [-P max-procs] [--max-procs=max-procs]
[--interactive] [--verbose] [--exit] [--no-run-if-empty]
[--arg-file=file] [--show-limits] [--version] [--help] [command
[initial-arguments]]

DESCRIPTION
This manual page documents the GNU version of xargs...


I am trying to get better at using documentation to learn about Linux programs, but that "Synopsis" section is intimidating to new users. It literally looks like gibberish compared to man locate or man free.



So far, I understand that square brackets mean optional and nested brackets mean options in optional. But how am I supposed to induce a valid command with that?



I am not asking for help with xargs here. I am looking for help interpreting a man page to understand complicated commands. I want to stop making Google-indexed web blogs and personal help from others my first approach to learning Linux commands.










share|improve this question




















  • 17




    Continue reading the man page. The "OPTIONS" section explains all the options available in the "SYNOPSIS" section.
    – John
    Apr 1 '15 at 12:57






  • 6




    start with man man
    – mikeserv
    Apr 1 '15 at 13:02






  • 14




    More often than not, go directly to the bottom and look for an examples section.
    – teppic
    Apr 1 '15 at 13:05






  • 9




    And don't just scan the man page for keywords. Really read it! Supposed strange behaviors are often well explained.
    – FloHimself
    Apr 1 '15 at 13:07






  • 6




    after man man read man intro.
    – mikeserv
    Apr 1 '15 at 14:56















up vote
87
down vote

favorite
51












While researching another problem, I came across a command,



locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


that I wanted to learn more about. So I ran man xargs and get the following output:



XARGS(1)                    General Commands Manual                   XARGS(1)

NAME
xargs - build and execute command lines from standard input

SYNOPSIS
xargs [-0prtx] [-E eof-str] [-e[eof-str]] [--eof[=eof-str]] [--null]
[-d delimiter] [--delimiter delimiter] [-I replace-str] [-i[replace-
str]] [--replace[=replace-str]] [-l[max-lines]] [-L max-lines]
[--max-lines[=max-lines]] [-n max-args] [--max-args=max-args] [-s max-
chars] [--max-chars=max-chars] [-P max-procs] [--max-procs=max-procs]
[--interactive] [--verbose] [--exit] [--no-run-if-empty]
[--arg-file=file] [--show-limits] [--version] [--help] [command
[initial-arguments]]

DESCRIPTION
This manual page documents the GNU version of xargs...


I am trying to get better at using documentation to learn about Linux programs, but that "Synopsis" section is intimidating to new users. It literally looks like gibberish compared to man locate or man free.



So far, I understand that square brackets mean optional and nested brackets mean options in optional. But how am I supposed to induce a valid command with that?



I am not asking for help with xargs here. I am looking for help interpreting a man page to understand complicated commands. I want to stop making Google-indexed web blogs and personal help from others my first approach to learning Linux commands.










share|improve this question




















  • 17




    Continue reading the man page. The "OPTIONS" section explains all the options available in the "SYNOPSIS" section.
    – John
    Apr 1 '15 at 12:57






  • 6




    start with man man
    – mikeserv
    Apr 1 '15 at 13:02






  • 14




    More often than not, go directly to the bottom and look for an examples section.
    – teppic
    Apr 1 '15 at 13:05






  • 9




    And don't just scan the man page for keywords. Really read it! Supposed strange behaviors are often well explained.
    – FloHimself
    Apr 1 '15 at 13:07






  • 6




    after man man read man intro.
    – mikeserv
    Apr 1 '15 at 14:56













up vote
87
down vote

favorite
51









up vote
87
down vote

favorite
51






51





While researching another problem, I came across a command,



locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


that I wanted to learn more about. So I ran man xargs and get the following output:



XARGS(1)                    General Commands Manual                   XARGS(1)

NAME
xargs - build and execute command lines from standard input

SYNOPSIS
xargs [-0prtx] [-E eof-str] [-e[eof-str]] [--eof[=eof-str]] [--null]
[-d delimiter] [--delimiter delimiter] [-I replace-str] [-i[replace-
str]] [--replace[=replace-str]] [-l[max-lines]] [-L max-lines]
[--max-lines[=max-lines]] [-n max-args] [--max-args=max-args] [-s max-
chars] [--max-chars=max-chars] [-P max-procs] [--max-procs=max-procs]
[--interactive] [--verbose] [--exit] [--no-run-if-empty]
[--arg-file=file] [--show-limits] [--version] [--help] [command
[initial-arguments]]

DESCRIPTION
This manual page documents the GNU version of xargs...


I am trying to get better at using documentation to learn about Linux programs, but that "Synopsis" section is intimidating to new users. It literally looks like gibberish compared to man locate or man free.



So far, I understand that square brackets mean optional and nested brackets mean options in optional. But how am I supposed to induce a valid command with that?



I am not asking for help with xargs here. I am looking for help interpreting a man page to understand complicated commands. I want to stop making Google-indexed web blogs and personal help from others my first approach to learning Linux commands.










share|improve this question















While researching another problem, I came across a command,



locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


that I wanted to learn more about. So I ran man xargs and get the following output:



XARGS(1)                    General Commands Manual                   XARGS(1)

NAME
xargs - build and execute command lines from standard input

SYNOPSIS
xargs [-0prtx] [-E eof-str] [-e[eof-str]] [--eof[=eof-str]] [--null]
[-d delimiter] [--delimiter delimiter] [-I replace-str] [-i[replace-
str]] [--replace[=replace-str]] [-l[max-lines]] [-L max-lines]
[--max-lines[=max-lines]] [-n max-args] [--max-args=max-args] [-s max-
chars] [--max-chars=max-chars] [-P max-procs] [--max-procs=max-procs]
[--interactive] [--verbose] [--exit] [--no-run-if-empty]
[--arg-file=file] [--show-limits] [--version] [--help] [command
[initial-arguments]]

DESCRIPTION
This manual page documents the GNU version of xargs...


I am trying to get better at using documentation to learn about Linux programs, but that "Synopsis" section is intimidating to new users. It literally looks like gibberish compared to man locate or man free.



So far, I understand that square brackets mean optional and nested brackets mean options in optional. But how am I supposed to induce a valid command with that?



I am not asking for help with xargs here. I am looking for help interpreting a man page to understand complicated commands. I want to stop making Google-indexed web blogs and personal help from others my first approach to learning Linux commands.







man






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 20 '17 at 10:04









Community

1




1










asked Apr 1 '15 at 12:54









user1717828

1,62411326




1,62411326








  • 17




    Continue reading the man page. The "OPTIONS" section explains all the options available in the "SYNOPSIS" section.
    – John
    Apr 1 '15 at 12:57






  • 6




    start with man man
    – mikeserv
    Apr 1 '15 at 13:02






  • 14




    More often than not, go directly to the bottom and look for an examples section.
    – teppic
    Apr 1 '15 at 13:05






  • 9




    And don't just scan the man page for keywords. Really read it! Supposed strange behaviors are often well explained.
    – FloHimself
    Apr 1 '15 at 13:07






  • 6




    after man man read man intro.
    – mikeserv
    Apr 1 '15 at 14:56














  • 17




    Continue reading the man page. The "OPTIONS" section explains all the options available in the "SYNOPSIS" section.
    – John
    Apr 1 '15 at 12:57






  • 6




    start with man man
    – mikeserv
    Apr 1 '15 at 13:02






  • 14




    More often than not, go directly to the bottom and look for an examples section.
    – teppic
    Apr 1 '15 at 13:05






  • 9




    And don't just scan the man page for keywords. Really read it! Supposed strange behaviors are often well explained.
    – FloHimself
    Apr 1 '15 at 13:07






  • 6




    after man man read man intro.
    – mikeserv
    Apr 1 '15 at 14:56








17




17




Continue reading the man page. The "OPTIONS" section explains all the options available in the "SYNOPSIS" section.
– John
Apr 1 '15 at 12:57




Continue reading the man page. The "OPTIONS" section explains all the options available in the "SYNOPSIS" section.
– John
Apr 1 '15 at 12:57




6




6




start with man man
– mikeserv
Apr 1 '15 at 13:02




start with man man
– mikeserv
Apr 1 '15 at 13:02




14




14




More often than not, go directly to the bottom and look for an examples section.
– teppic
Apr 1 '15 at 13:05




More often than not, go directly to the bottom and look for an examples section.
– teppic
Apr 1 '15 at 13:05




9




9




And don't just scan the man page for keywords. Really read it! Supposed strange behaviors are often well explained.
– FloHimself
Apr 1 '15 at 13:07




And don't just scan the man page for keywords. Really read it! Supposed strange behaviors are often well explained.
– FloHimself
Apr 1 '15 at 13:07




6




6




after man man read man intro.
– mikeserv
Apr 1 '15 at 14:56




after man man read man intro.
– mikeserv
Apr 1 '15 at 14:56










11 Answers
11






active

oldest

votes

















up vote
97
down vote



accepted
+300










Well, this is my very personal way to read manpages:



The manpager



When you open a manpage using the man command, the output will be displayed/rendered by the less or more commands, or any other command that will be set as your pager(manpager).



If you are using Linux you are probably served with your man infrastructure already configured to use /usr/bin/less -is (unless you installed some minimal distro) as man(1), explain on it's Options section:



-P pager
Specify which pager to use. This option overrides the MANPAGER environment variable,
which in turn overrides the PAGER variable. By default, man uses /usr/bin/less -is.


On FreeBSD and OpenBSD is just a matter of editing the MANPAGER environment variable since they will mostly use more, and some features like search and text highlight could be missing.



There is a good answer to the question of what differences more, less and most have here(never used most). The ability to scroll backwards and scroll forward by page with Space or both ways by line with or (also, using vi bindings j and k) is essential while browsing manpages. Press h while using less to see the summary of commands available.



And that's why I suggest you to use less as your man pager. less have some essential features that will be used during this answer.



How is a command formatted?



Utility Conventions: The Open Group Base Specifications Issue 7 - IEEE Std 1003.1, 2013 Edition. You should visit that link before trying to understand a manpage. This online reference describes the argument syntax of the standard utilities and introduces terminology used throughout POSIX.1-2017 for describing the arguments processed by the utilities. This will also indirectly get you updated about the real meaning of words like parameters, arguments, argument option...



The head of any manpage will look less cryptic to you after understanding the notation of the utility conventions:



utility_name[-a][-b][-c option_argument]
[-d|-e][-f[option_argument]][operand...]


Have in mind what you want to do.



When doing your research about xargs you did it for a purpouse, right? You had a specific need that was reading standard output and executing commands based on that output.



But, when I don't know which command I want?



Use man -k or apropos (they are equivalent). If I don't know how to find a file: man -k file | grep search. Read the descriptions and find one that will better fit your needs. Example:



apropos -r '^report'
bashbug (1) - report a bug in bash
df (1) - report file system disk space usage
e2freefrag (8) - report free space fragmentation information
filefrag (8) - report on file fragmentation
iwgetid (8) - Report ESSID, NWID or AP/Cell Address of wireless network
kbd_mode (1) - report or set the keyboard mode
lastlog (8) - reports the most recent login of all users or of a given user
pmap (1) - report memory map of a process
ps (1) - report a snapshot of the current processes.
pwdx (1) - report current working directory of a process
uniq (1) - report or omit repeated lines
vmstat (8) - Report virtual memory statistics


Apropos works with regular expressions by default, (man apropos, read the description and find out what -r does), and on this example I'm looking for every manpage where the description starts with "report".



To look for information related with reading standard input/output processing and reaching xargs as a possible option:



man -k command| grep input
xargs (1) - build and execute command lines from standard input


Always read the DESCRIPTION before starting



Take a time and read the description. By just reading the description of the xargs command we will learn that:





  • xargs reads from STDIN and executes the command needed. This also means that you will need to have some knowledge of how standard input works, and how to manipulate it through pipes to chain commands

  • The default behavior is to act like /bin/echo. This gives you a little tip that if you need to chain more than one xargs, you don't need to use echo to print.

  • We have also learned that unix filenames can contain blank and newlines, that this could be a problem and the argument -0 is a way to prevent things explode by using null character separators. The description warns you that the command being used as input needs to support this feature too, and that GNU find support it. Great. We use a lot of find with xargs.


  • xargs will stop if exit status 255 is reached.


Some descriptions are very short and that is generally because the software works on a very simple way. Don't even think of skipping this part of the manpage ;)



Other things to pay attention...



You know that you can search for files using find. There is a ton of options and if you only look at the SYNOPSIS, you will get overwhelmed by those. It's just the tip of the iceberg. Excluding NAME, SYNOPSIS, and DESCRIPTION, you will have the following sections:




  • AUTHORS: the people who created or assisted in the creation of the
    command.


  • BUGS: lists any known defects. Could be only implementation limitations.


  • ENVIRONMENT: Aspects of your shell that could be affected by the command, or variables that will be used.


  • EXAMPLES or NOTES: Self explanatory.


  • REPORTING BUGS: Who you will have to contact if you find bugs on this tool or in its documentation.


  • COPYRIGHT: Person who created and disclaimers about the software. All related with the license of the software itself.


  • SEE ALSO: Other commands, tools or working aspects that are related to this command, and could not fit on any of the other sections.



You will most probably find interesting info about the aspects you want of a tool on the examples/notes section.



Example



On the following steps I'll take find as an example, since it's concepts are "more simple" than xargs to explain(one command find files and the other deals with stdin and pipelined execution of other command output). Let's just pretend that we know nothing(or very little) about this command.



I have a specific problem that is: I have to look for every file with the .jpg extension, and with 500KiB (KiB = 1024 byte, commonly called kibibyte), or more in size inside a ftp server folder.



First, open the manual: man find. The SYNOPSIS is slim. Let's search for things inside the manual: Type / plus the word you want (size). It will index a lot of entries -size that will count specific sizes. Got stuck. Don't know how to search with "more than" or "less than" a given size, and the man does not show that to me.



Let's give it a try, and search for the next entry found by hitting n. OK. Found something interesting: find ( -size +100M -fprintf /root/big.txt %-10s %pn ). Maybe this example is showing us that with -size +100M it will find files with 100MB or more. How could I confirm? Going to the head of the manpage and searching for other words.



Again, let's try the word greater. Pressing g will lead us to the head of the manpage. /greater, and the first entry is:



 Numeric arguments can be specified as

+n for **greater** than n,

-n for less than n,

n for exactly n.


Sounds great. It seems that this block of the manual confirmed what we suspected. However, this will not only apply to file sizes. It will apply to any n that can be found on this manpage (as the phrase said: "Numeric arguments can be specified as").



Good. Let us find a way to filter by name: g /insensitive. Why? Insensitive? Wtf? We have a hypothetical ftp server, where "that other OS" people could give a file name with extensions as .jpg, .JPG , .JpG. This will lead us to:



-ilname pattern
Like -lname, but the match is case insensitive. If the -L
option or the -follow option is in effect, this test returns
false unless the symbolic link is broken.


However, after you search for lname you will see that this will only search for symbolic links. We want real files. The next entry:



   -iname pattern
Like -name, but the match is case insensitive. For example, the
patterns `fo*' and `F??' match the file names `Foo', `FOO',
`foo', `fOo', etc. In these patterns, unlike filename expan‐
sion by the shell, an initial '.' can be matched by `*'. That
is, find -name *bar will match the file `.foobar'. Please note
that you should quote patterns as a matter of course, otherwise
the shell will expand any wildcard characters in them.


Great. I don't even need to read about -name to see that -iname is the case insensitive version of this argument. Lets assemble the command:



Command: find /ftp/dir/ -size +500k -iname "*.jpg"



What is implicit here: The knowledge that the wildcard ? represents "any character at a single position" and * represents "zero or more of any character". The -name parameter will give you a summary of this knowledge.



Tips that apply to all commands



Some options, mnemonics and "syntax style" travel through all commands making you buy some time by not having to open the manpage at all. Those are learned by practice and the most common are:




  • Generally, -v means verbose. -vvv is a variation "very very verbose" on some software.

  • Following the POSIX standard, generally one dash arguments can be stacked. Example: tar -xzvf, cp -Rv.

  • Generally -R and/or -r means recursive.

  • Almost all commands have a brief help with the --help option.


  • --version shows the version of a software.


  • -p, on copy or move utilities means "preserve permissions".


  • -y means YES, or "proceed without confirmation" in most cases.


Note that the above are not always true though. For example, the -r switch can mean very different things for different software. It is always a good idea to check and make sure when a command could be dangerous, but these are common defaults.



Default values of commands.



At the pager chunk of this answer, we saw that less -is is the pager of man. The default behavior of commands are not always shown at a separated section on manpages, or at the section that is most top placed.



You will have to read the options to find out defaults, or if you are lucky, typing /pager will lead you to that info. This also requires you to know the concept of the pager(software that scrolls the manpage), and this is a thing you will only acquire after reading lots of manpages.



Why is that important? This will open up your perception if you find differences on scroll and color behavior while reading man(1) on Linux(less -is pager) or FreeBSD man(1) for example.



And what about the SYNOPSIS syntax?



After getting all the information needed to execute the command, you can combine options, option-arguments and operands inline to make your job done. Overview of concepts:




  • Options are the switches that dictates a command behavior. "Do this"
    "don't do this" or "act this way". Often called switches.

  • Option-arguments are used on most cases when an option isn´t
    binary(on/off) like -t on mount, that specifies the type of a
    filesystem(-t iso9660, -t ext2). "Do this with closed eyes" or
    "feed the animals, but only the lions". Also called arguments.

  • Operands are things you want that command to act upon. If you use
    cat file.txt, the operand is a file inside your current
    directory, and it´s contents will be shown on STDOUT. ls is a
    command where an operand is optional. The three dots after the operand
    implicitly tells you that cat can act on multiple operands(files) at
    the same time. You may notice that some commands have set what type of
    operand it will use. Example: cat [OPTION] [FILE]...


Related synopsis stuff:




  • Understand synopsis in manpage


When will this method not work?




  • Manpages that have no examples

  • Manpages where options have a short explanation

  • When you use generic keywords like and, to, for inside the manpages

  • Manpages that are not installed. It seems to be obvious but, if you don't have lftp (and its manpages) installed you can't know that is a suitable option as a more sophisticated ftp client by running man -k ftp


In some cases the examples will be pretty simple, and you will have to make some executions of your command to test, or in a worst case scenario, Google it.



Other: Programming languages and it's modules:



If you are programming or just creating scripts, keep in mind that some languages have it's own manpages systems, like perl(perldocs), python(pydocs), etc, holding specific information about methods/funcions, variables, behavior, and other important information about the module you are trying to use and learn. This was useful to me when i was creating a script to download unread IMAP emails using the perl Mail::IMAPClient module.



You will have to figure out those specific manpages by using man -k or searching online. Examples:



[root@host ~]# man -k doc | grep perl
perldoc (1) - Look up Perl documentation in Pod format


[root@host ~]# perldoc Mail::IMAPClient
IMAPCLIENT(1) User Contributed Perl Documentation IMAPCLIENT(1)

NAME
Mail::IMAPClient - An IMAP Client API

SYNOPSIS
use Mail::IMAPClient;

my $imap = Mail::IMAPClient->new(
Server => ’localhost’,
User => ’username’,
Password => ’password’,
Ssl => 1,
Uid => 1,
);


...tons of other stuff here, with sections like a regular manpage...



With python:



[root@host ~]# pydoc sys
Help on built-in module sys:

NAME
sys

FILE
(built-in)

MODULE DOCS
http://www.python.org/doc/current/lib/module-sys.html

DESCRIPTION
This module provides access to some objects used or maintained by the
interpreter and to functions that interact strongly with the interpreter.
...again, another full-featured manpage with interesting info...


Or, the help() funcion inside python shell if you want to read more details of some object:



nwildner@host:~$ python3.6
Python 3.6.7 (default, Oct 21 2018, 08:08:16)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help(round)

Help on built-in function round in module builtins:

round(...)
round(number[, ndigits]) -> number

Round a number to a given precision in decimal digits (default 0 digits).
This returns an int when called with one argument, otherwise the
same type as the number. ndigits may be negative.





share|improve this answer























  • You can also do man find | grep .... I like man command | sed -n '/^[[:space:]]*-/,/^$/p'
    – mikeserv
    Apr 1 '15 at 14:48






  • 6




    Yup. You can. I was just assuming that the operator is "noob" and trying to get started with manpages :)
    – nwildner
    Apr 1 '15 at 14:49






  • 3




    This answer needs to be the top result for "How do I effectively use man?" Thank you and well done.
    – user1717828
    Apr 1 '15 at 14:58








  • 8




    @nwildner, you deserve a candy after such huge and well formated answer. Good job!
    – Willian Paixao
    Apr 2 '15 at 4:10






  • 6




    I think this should be added to Linux. As a man page of course.
    – myaut
    Apr 6 '15 at 22:26


















up vote
37
down vote













This is quite nicely explained in man man:



   The following conventions apply to the SYNOPSIS section and can be used
as a guide in other sections.

bold text type exactly as shown.
italic text replace with appropriate argument.
[-abc] any or all arguments within [ ] are optional.
-a|-b options delimited by | cannot be used together.

argument ... argument is repeatable.
[expression] ... entire expression within [ ] is repeatable.


As for how you're supposed to write a valid command from that, well, you're not. The synopsis is useful once you know how a command works. It can help you refresh your memory. In order to understand how the command works, you should read the man page. Especially the descriptions of the options and the examples section.



Sometimes the synopsis is enough. For example, in man ls:



SYNOPSIS
ls [OPTION]... [FILE]...


Other times, it is useless unless you already know how to use the command in question. For example, man dd:



   dd [OPERAND]...
dd OPTION


So, in conclusion, don't worry if you don't get the synopsis. That's normal. Read the man page itself.






share|improve this answer





















  • Thank you for the advice, especially the "As for how..." paragraph.
    – user1717828
    Apr 1 '15 at 14:59


















up vote
21
down vote













Some basics to understand synopsis




  • each [foo] represent optional argument or parameter.

  • when [foo [ bar ] ] syntax is used, you may use foo, and you may add bar.

  • mandatory option parameter are used this way [ -S size ] , which tell that -S argument is waiting for a mandatory size.


For instance : foo [-S size ] filename ...



means




  • command is foo

  • optional paramter -S can be use, you have to tell size (name give you a hint)

  • mandatory argument is filename (this give you an hint also, see man mkdir )

  • elipsis ... tell you you can use multiple file.


You still have to go in depth of man page to understand option (in my sample case above, what -S size is about )






share|improve this answer






























    up vote
    14
    down vote













    man pages normally are displayed with less nowadays. That makes it possible to search through them. I would not bother with the synopsis, especially not because you have a particular commandline that you want to understand.



    Hit the / and start typing -I and then Enter. The first hit will be in the synopsis, the second (use n for next) gets you the detailed explanation for -I.






    share|improve this answer




























      up vote
      11
      down vote













      One key thing to remember is that you cannot only look at the manual for one command, in the case of commands that execute other commands.



      For your example command



      locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


      You need information on not only xargs but also bash and [ (this may be in the test manpage). You may also need information on your shell (probably also bash) for the quoting rules, since your command includes a complex quoted string. I can already tell you that the quoted argument is wrong (and wrong in a way that will only show up when you encounter a file with spaces in the name); the inner "{}" should probably be '{}'.



      So first you would refer to the xargs manpage and see [-I replace-str] for what -I {} means, and [command [initial-arguments]] for what bash and everything after it means. Then you would refer to the bash manpage for what -c does, etc.






      share|improve this answer




























        up vote
        6
        down vote













        Adding on to the great answers already given:



        1) If you're interested in a gnu utility, especially ones like sed and grep, sometimes, using the info command will bring up a greatly expanded version of the command information. sed, for instance, has a detailed section on how to write regular expressions and another section with some very complex usage examples.



        2) It's a "manual". A manual is primarily designed to help you remember the details of something you already understand. It's designed so you can get the details you need quickly and get out. (And way too many have no usage examples or only trivial ones.)



        When I need to learn something new, even a small feature of a command that isn't clear to me, I go to the web and search using the best keywords I can think of (e.g. Linux xargs) and add the word howto, examples, or tutorial. This is very often quite productive.



        I usually use duckduckgo because it maintains my privacy, but if I need more control of my searches, I use Google because I can tell it just to search within one website or to only return results from the last year. (It has many other Advanced Search options. You can Google them. ;) )



        Another tip:



        For commands I reference often, I save the man page in a text file



        man bash > bashman.txt


        and load that file into another window in my text editor so I can flip back and forth, copy and paste, etc.. I usually make the file read only, so I don't end up mangling it by accident, but since it's my personal copy, I could edit it in any way I want to, adding tags so I can find a section more easily or even adding my own notes or examples.



        The only drawback to this is that the original man page may be updated and my copy is static.






        share|improve this answer






























          up vote
          4
          down vote













          To get a quick help with your specific command, you can use Explain Shell. E.g. your command. After getting the first high-level understanding how this works, you should proceed with manpages as other answers recommend.






          share|improve this answer




























            up vote
            2
            down vote













            There are tow useful tools to learn more about the linux commands:





            1. cheat will display the frequently used option for a command line. Also you can add your own command + option to be displayed through cheat for a specific command.


            2. bropages tool provides some example for a command line , it is possible to add you own example or upvote / downvote the given example after getting the verification code through bro thanks. The must voted command will appear on the top of the bro page.






            share|improve this answer




























              up vote
              1
              down vote













              I suggest tldr for a comprehensive man-alike tool. Simplified and community-driven man pages. In ubuntu you can install it via snap, but it has versions for other distros as well. It also provides you with several common example uses. 100% recomended.






              share|improve this answer




























                up vote
                0
                down vote













                > I am looking for help interpreting a man page to understand complicated commands.



                I think that's the misunderstanding here. What makes Linux/UNIX so powerful is that you can construct very long and effective commands by e.g. redirecting the stdout of one command (here, locate) to the stdin of another (here, xargs) through a pipe (|). Hence, as Random832 correctly said, you won't find a single manpage that explains what your example command does.



                I recommend that you read a Linux shell scripting guide; the Advanced Bash-Scripting Guide is an excellent document. Please don't be intimidated by it; mastering Linux requires years and is a never-ending process, but you can learn the basics in a reasonable amount of time.



                Then, refer to manpages when you need to know the details of a specific command.



                Once you've got the gist of it, Commandlinefu and Bash One-Liners are also worth reading to get good examples.






                share|improve this answer






























                  up vote
                  -1
                  down vote













                  To search for something particular in commands in a man page, you can use:



                  man echo | grep output.


                  But to search for switches (for example -n), you have to use it this way:



                  man echo | grep -- -n





                  share|improve this answer






















                    protected by Kusalananda Sep 9 '17 at 18:27



                    Thank you for your interest in this question.
                    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                    Would you like to answer one of these unanswered questions instead?














                    11 Answers
                    11






                    active

                    oldest

                    votes








                    11 Answers
                    11






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes








                    up vote
                    97
                    down vote



                    accepted
                    +300










                    Well, this is my very personal way to read manpages:



                    The manpager



                    When you open a manpage using the man command, the output will be displayed/rendered by the less or more commands, or any other command that will be set as your pager(manpager).



                    If you are using Linux you are probably served with your man infrastructure already configured to use /usr/bin/less -is (unless you installed some minimal distro) as man(1), explain on it's Options section:



                    -P pager
                    Specify which pager to use. This option overrides the MANPAGER environment variable,
                    which in turn overrides the PAGER variable. By default, man uses /usr/bin/less -is.


                    On FreeBSD and OpenBSD is just a matter of editing the MANPAGER environment variable since they will mostly use more, and some features like search and text highlight could be missing.



                    There is a good answer to the question of what differences more, less and most have here(never used most). The ability to scroll backwards and scroll forward by page with Space or both ways by line with or (also, using vi bindings j and k) is essential while browsing manpages. Press h while using less to see the summary of commands available.



                    And that's why I suggest you to use less as your man pager. less have some essential features that will be used during this answer.



                    How is a command formatted?



                    Utility Conventions: The Open Group Base Specifications Issue 7 - IEEE Std 1003.1, 2013 Edition. You should visit that link before trying to understand a manpage. This online reference describes the argument syntax of the standard utilities and introduces terminology used throughout POSIX.1-2017 for describing the arguments processed by the utilities. This will also indirectly get you updated about the real meaning of words like parameters, arguments, argument option...



                    The head of any manpage will look less cryptic to you after understanding the notation of the utility conventions:



                    utility_name[-a][-b][-c option_argument]
                    [-d|-e][-f[option_argument]][operand...]


                    Have in mind what you want to do.



                    When doing your research about xargs you did it for a purpouse, right? You had a specific need that was reading standard output and executing commands based on that output.



                    But, when I don't know which command I want?



                    Use man -k or apropos (they are equivalent). If I don't know how to find a file: man -k file | grep search. Read the descriptions and find one that will better fit your needs. Example:



                    apropos -r '^report'
                    bashbug (1) - report a bug in bash
                    df (1) - report file system disk space usage
                    e2freefrag (8) - report free space fragmentation information
                    filefrag (8) - report on file fragmentation
                    iwgetid (8) - Report ESSID, NWID or AP/Cell Address of wireless network
                    kbd_mode (1) - report or set the keyboard mode
                    lastlog (8) - reports the most recent login of all users or of a given user
                    pmap (1) - report memory map of a process
                    ps (1) - report a snapshot of the current processes.
                    pwdx (1) - report current working directory of a process
                    uniq (1) - report or omit repeated lines
                    vmstat (8) - Report virtual memory statistics


                    Apropos works with regular expressions by default, (man apropos, read the description and find out what -r does), and on this example I'm looking for every manpage where the description starts with "report".



                    To look for information related with reading standard input/output processing and reaching xargs as a possible option:



                    man -k command| grep input
                    xargs (1) - build and execute command lines from standard input


                    Always read the DESCRIPTION before starting



                    Take a time and read the description. By just reading the description of the xargs command we will learn that:





                    • xargs reads from STDIN and executes the command needed. This also means that you will need to have some knowledge of how standard input works, and how to manipulate it through pipes to chain commands

                    • The default behavior is to act like /bin/echo. This gives you a little tip that if you need to chain more than one xargs, you don't need to use echo to print.

                    • We have also learned that unix filenames can contain blank and newlines, that this could be a problem and the argument -0 is a way to prevent things explode by using null character separators. The description warns you that the command being used as input needs to support this feature too, and that GNU find support it. Great. We use a lot of find with xargs.


                    • xargs will stop if exit status 255 is reached.


                    Some descriptions are very short and that is generally because the software works on a very simple way. Don't even think of skipping this part of the manpage ;)



                    Other things to pay attention...



                    You know that you can search for files using find. There is a ton of options and if you only look at the SYNOPSIS, you will get overwhelmed by those. It's just the tip of the iceberg. Excluding NAME, SYNOPSIS, and DESCRIPTION, you will have the following sections:




                    • AUTHORS: the people who created or assisted in the creation of the
                      command.


                    • BUGS: lists any known defects. Could be only implementation limitations.


                    • ENVIRONMENT: Aspects of your shell that could be affected by the command, or variables that will be used.


                    • EXAMPLES or NOTES: Self explanatory.


                    • REPORTING BUGS: Who you will have to contact if you find bugs on this tool or in its documentation.


                    • COPYRIGHT: Person who created and disclaimers about the software. All related with the license of the software itself.


                    • SEE ALSO: Other commands, tools or working aspects that are related to this command, and could not fit on any of the other sections.



                    You will most probably find interesting info about the aspects you want of a tool on the examples/notes section.



                    Example



                    On the following steps I'll take find as an example, since it's concepts are "more simple" than xargs to explain(one command find files and the other deals with stdin and pipelined execution of other command output). Let's just pretend that we know nothing(or very little) about this command.



                    I have a specific problem that is: I have to look for every file with the .jpg extension, and with 500KiB (KiB = 1024 byte, commonly called kibibyte), or more in size inside a ftp server folder.



                    First, open the manual: man find. The SYNOPSIS is slim. Let's search for things inside the manual: Type / plus the word you want (size). It will index a lot of entries -size that will count specific sizes. Got stuck. Don't know how to search with "more than" or "less than" a given size, and the man does not show that to me.



                    Let's give it a try, and search for the next entry found by hitting n. OK. Found something interesting: find ( -size +100M -fprintf /root/big.txt %-10s %pn ). Maybe this example is showing us that with -size +100M it will find files with 100MB or more. How could I confirm? Going to the head of the manpage and searching for other words.



                    Again, let's try the word greater. Pressing g will lead us to the head of the manpage. /greater, and the first entry is:



                     Numeric arguments can be specified as

                    +n for **greater** than n,

                    -n for less than n,

                    n for exactly n.


                    Sounds great. It seems that this block of the manual confirmed what we suspected. However, this will not only apply to file sizes. It will apply to any n that can be found on this manpage (as the phrase said: "Numeric arguments can be specified as").



                    Good. Let us find a way to filter by name: g /insensitive. Why? Insensitive? Wtf? We have a hypothetical ftp server, where "that other OS" people could give a file name with extensions as .jpg, .JPG , .JpG. This will lead us to:



                    -ilname pattern
                    Like -lname, but the match is case insensitive. If the -L
                    option or the -follow option is in effect, this test returns
                    false unless the symbolic link is broken.


                    However, after you search for lname you will see that this will only search for symbolic links. We want real files. The next entry:



                       -iname pattern
                    Like -name, but the match is case insensitive. For example, the
                    patterns `fo*' and `F??' match the file names `Foo', `FOO',
                    `foo', `fOo', etc. In these patterns, unlike filename expan‐
                    sion by the shell, an initial '.' can be matched by `*'. That
                    is, find -name *bar will match the file `.foobar'. Please note
                    that you should quote patterns as a matter of course, otherwise
                    the shell will expand any wildcard characters in them.


                    Great. I don't even need to read about -name to see that -iname is the case insensitive version of this argument. Lets assemble the command:



                    Command: find /ftp/dir/ -size +500k -iname "*.jpg"



                    What is implicit here: The knowledge that the wildcard ? represents "any character at a single position" and * represents "zero or more of any character". The -name parameter will give you a summary of this knowledge.



                    Tips that apply to all commands



                    Some options, mnemonics and "syntax style" travel through all commands making you buy some time by not having to open the manpage at all. Those are learned by practice and the most common are:




                    • Generally, -v means verbose. -vvv is a variation "very very verbose" on some software.

                    • Following the POSIX standard, generally one dash arguments can be stacked. Example: tar -xzvf, cp -Rv.

                    • Generally -R and/or -r means recursive.

                    • Almost all commands have a brief help with the --help option.


                    • --version shows the version of a software.


                    • -p, on copy or move utilities means "preserve permissions".


                    • -y means YES, or "proceed without confirmation" in most cases.


                    Note that the above are not always true though. For example, the -r switch can mean very different things for different software. It is always a good idea to check and make sure when a command could be dangerous, but these are common defaults.



                    Default values of commands.



                    At the pager chunk of this answer, we saw that less -is is the pager of man. The default behavior of commands are not always shown at a separated section on manpages, or at the section that is most top placed.



                    You will have to read the options to find out defaults, or if you are lucky, typing /pager will lead you to that info. This also requires you to know the concept of the pager(software that scrolls the manpage), and this is a thing you will only acquire after reading lots of manpages.



                    Why is that important? This will open up your perception if you find differences on scroll and color behavior while reading man(1) on Linux(less -is pager) or FreeBSD man(1) for example.



                    And what about the SYNOPSIS syntax?



                    After getting all the information needed to execute the command, you can combine options, option-arguments and operands inline to make your job done. Overview of concepts:




                    • Options are the switches that dictates a command behavior. "Do this"
                      "don't do this" or "act this way". Often called switches.

                    • Option-arguments are used on most cases when an option isn´t
                      binary(on/off) like -t on mount, that specifies the type of a
                      filesystem(-t iso9660, -t ext2). "Do this with closed eyes" or
                      "feed the animals, but only the lions". Also called arguments.

                    • Operands are things you want that command to act upon. If you use
                      cat file.txt, the operand is a file inside your current
                      directory, and it´s contents will be shown on STDOUT. ls is a
                      command where an operand is optional. The three dots after the operand
                      implicitly tells you that cat can act on multiple operands(files) at
                      the same time. You may notice that some commands have set what type of
                      operand it will use. Example: cat [OPTION] [FILE]...


                    Related synopsis stuff:




                    • Understand synopsis in manpage


                    When will this method not work?




                    • Manpages that have no examples

                    • Manpages where options have a short explanation

                    • When you use generic keywords like and, to, for inside the manpages

                    • Manpages that are not installed. It seems to be obvious but, if you don't have lftp (and its manpages) installed you can't know that is a suitable option as a more sophisticated ftp client by running man -k ftp


                    In some cases the examples will be pretty simple, and you will have to make some executions of your command to test, or in a worst case scenario, Google it.



                    Other: Programming languages and it's modules:



                    If you are programming or just creating scripts, keep in mind that some languages have it's own manpages systems, like perl(perldocs), python(pydocs), etc, holding specific information about methods/funcions, variables, behavior, and other important information about the module you are trying to use and learn. This was useful to me when i was creating a script to download unread IMAP emails using the perl Mail::IMAPClient module.



                    You will have to figure out those specific manpages by using man -k or searching online. Examples:



                    [root@host ~]# man -k doc | grep perl
                    perldoc (1) - Look up Perl documentation in Pod format


                    [root@host ~]# perldoc Mail::IMAPClient
                    IMAPCLIENT(1) User Contributed Perl Documentation IMAPCLIENT(1)

                    NAME
                    Mail::IMAPClient - An IMAP Client API

                    SYNOPSIS
                    use Mail::IMAPClient;

                    my $imap = Mail::IMAPClient->new(
                    Server => ’localhost’,
                    User => ’username’,
                    Password => ’password’,
                    Ssl => 1,
                    Uid => 1,
                    );


                    ...tons of other stuff here, with sections like a regular manpage...



                    With python:



                    [root@host ~]# pydoc sys
                    Help on built-in module sys:

                    NAME
                    sys

                    FILE
                    (built-in)

                    MODULE DOCS
                    http://www.python.org/doc/current/lib/module-sys.html

                    DESCRIPTION
                    This module provides access to some objects used or maintained by the
                    interpreter and to functions that interact strongly with the interpreter.
                    ...again, another full-featured manpage with interesting info...


                    Or, the help() funcion inside python shell if you want to read more details of some object:



                    nwildner@host:~$ python3.6
                    Python 3.6.7 (default, Oct 21 2018, 08:08:16)
                    [GCC 8.2.0] on linux
                    Type "help", "copyright", "credits" or "license" for more information.
                    >>> help(round)

                    Help on built-in function round in module builtins:

                    round(...)
                    round(number[, ndigits]) -> number

                    Round a number to a given precision in decimal digits (default 0 digits).
                    This returns an int when called with one argument, otherwise the
                    same type as the number. ndigits may be negative.





                    share|improve this answer























                    • You can also do man find | grep .... I like man command | sed -n '/^[[:space:]]*-/,/^$/p'
                      – mikeserv
                      Apr 1 '15 at 14:48






                    • 6




                      Yup. You can. I was just assuming that the operator is "noob" and trying to get started with manpages :)
                      – nwildner
                      Apr 1 '15 at 14:49






                    • 3




                      This answer needs to be the top result for "How do I effectively use man?" Thank you and well done.
                      – user1717828
                      Apr 1 '15 at 14:58








                    • 8




                      @nwildner, you deserve a candy after such huge and well formated answer. Good job!
                      – Willian Paixao
                      Apr 2 '15 at 4:10






                    • 6




                      I think this should be added to Linux. As a man page of course.
                      – myaut
                      Apr 6 '15 at 22:26















                    up vote
                    97
                    down vote



                    accepted
                    +300










                    Well, this is my very personal way to read manpages:



                    The manpager



                    When you open a manpage using the man command, the output will be displayed/rendered by the less or more commands, or any other command that will be set as your pager(manpager).



                    If you are using Linux you are probably served with your man infrastructure already configured to use /usr/bin/less -is (unless you installed some minimal distro) as man(1), explain on it's Options section:



                    -P pager
                    Specify which pager to use. This option overrides the MANPAGER environment variable,
                    which in turn overrides the PAGER variable. By default, man uses /usr/bin/less -is.


                    On FreeBSD and OpenBSD is just a matter of editing the MANPAGER environment variable since they will mostly use more, and some features like search and text highlight could be missing.



                    There is a good answer to the question of what differences more, less and most have here(never used most). The ability to scroll backwards and scroll forward by page with Space or both ways by line with or (also, using vi bindings j and k) is essential while browsing manpages. Press h while using less to see the summary of commands available.



                    And that's why I suggest you to use less as your man pager. less have some essential features that will be used during this answer.



                    How is a command formatted?



                    Utility Conventions: The Open Group Base Specifications Issue 7 - IEEE Std 1003.1, 2013 Edition. You should visit that link before trying to understand a manpage. This online reference describes the argument syntax of the standard utilities and introduces terminology used throughout POSIX.1-2017 for describing the arguments processed by the utilities. This will also indirectly get you updated about the real meaning of words like parameters, arguments, argument option...



                    The head of any manpage will look less cryptic to you after understanding the notation of the utility conventions:



                    utility_name[-a][-b][-c option_argument]
                    [-d|-e][-f[option_argument]][operand...]


                    Have in mind what you want to do.



                    When doing your research about xargs you did it for a purpouse, right? You had a specific need that was reading standard output and executing commands based on that output.



                    But, when I don't know which command I want?



                    Use man -k or apropos (they are equivalent). If I don't know how to find a file: man -k file | grep search. Read the descriptions and find one that will better fit your needs. Example:



                    apropos -r '^report'
                    bashbug (1) - report a bug in bash
                    df (1) - report file system disk space usage
                    e2freefrag (8) - report free space fragmentation information
                    filefrag (8) - report on file fragmentation
                    iwgetid (8) - Report ESSID, NWID or AP/Cell Address of wireless network
                    kbd_mode (1) - report or set the keyboard mode
                    lastlog (8) - reports the most recent login of all users or of a given user
                    pmap (1) - report memory map of a process
                    ps (1) - report a snapshot of the current processes.
                    pwdx (1) - report current working directory of a process
                    uniq (1) - report or omit repeated lines
                    vmstat (8) - Report virtual memory statistics


                    Apropos works with regular expressions by default, (man apropos, read the description and find out what -r does), and on this example I'm looking for every manpage where the description starts with "report".



                    To look for information related with reading standard input/output processing and reaching xargs as a possible option:



                    man -k command| grep input
                    xargs (1) - build and execute command lines from standard input


                    Always read the DESCRIPTION before starting



                    Take a time and read the description. By just reading the description of the xargs command we will learn that:





                    • xargs reads from STDIN and executes the command needed. This also means that you will need to have some knowledge of how standard input works, and how to manipulate it through pipes to chain commands

                    • The default behavior is to act like /bin/echo. This gives you a little tip that if you need to chain more than one xargs, you don't need to use echo to print.

                    • We have also learned that unix filenames can contain blank and newlines, that this could be a problem and the argument -0 is a way to prevent things explode by using null character separators. The description warns you that the command being used as input needs to support this feature too, and that GNU find support it. Great. We use a lot of find with xargs.


                    • xargs will stop if exit status 255 is reached.


                    Some descriptions are very short and that is generally because the software works on a very simple way. Don't even think of skipping this part of the manpage ;)



                    Other things to pay attention...



                    You know that you can search for files using find. There is a ton of options and if you only look at the SYNOPSIS, you will get overwhelmed by those. It's just the tip of the iceberg. Excluding NAME, SYNOPSIS, and DESCRIPTION, you will have the following sections:




                    • AUTHORS: the people who created or assisted in the creation of the
                      command.


                    • BUGS: lists any known defects. Could be only implementation limitations.


                    • ENVIRONMENT: Aspects of your shell that could be affected by the command, or variables that will be used.


                    • EXAMPLES or NOTES: Self explanatory.


                    • REPORTING BUGS: Who you will have to contact if you find bugs on this tool or in its documentation.


                    • COPYRIGHT: Person who created and disclaimers about the software. All related with the license of the software itself.


                    • SEE ALSO: Other commands, tools or working aspects that are related to this command, and could not fit on any of the other sections.



                    You will most probably find interesting info about the aspects you want of a tool on the examples/notes section.



                    Example



                    On the following steps I'll take find as an example, since it's concepts are "more simple" than xargs to explain(one command find files and the other deals with stdin and pipelined execution of other command output). Let's just pretend that we know nothing(or very little) about this command.



                    I have a specific problem that is: I have to look for every file with the .jpg extension, and with 500KiB (KiB = 1024 byte, commonly called kibibyte), or more in size inside a ftp server folder.



                    First, open the manual: man find. The SYNOPSIS is slim. Let's search for things inside the manual: Type / plus the word you want (size). It will index a lot of entries -size that will count specific sizes. Got stuck. Don't know how to search with "more than" or "less than" a given size, and the man does not show that to me.



                    Let's give it a try, and search for the next entry found by hitting n. OK. Found something interesting: find ( -size +100M -fprintf /root/big.txt %-10s %pn ). Maybe this example is showing us that with -size +100M it will find files with 100MB or more. How could I confirm? Going to the head of the manpage and searching for other words.



                    Again, let's try the word greater. Pressing g will lead us to the head of the manpage. /greater, and the first entry is:



                     Numeric arguments can be specified as

                    +n for **greater** than n,

                    -n for less than n,

                    n for exactly n.


                    Sounds great. It seems that this block of the manual confirmed what we suspected. However, this will not only apply to file sizes. It will apply to any n that can be found on this manpage (as the phrase said: "Numeric arguments can be specified as").



                    Good. Let us find a way to filter by name: g /insensitive. Why? Insensitive? Wtf? We have a hypothetical ftp server, where "that other OS" people could give a file name with extensions as .jpg, .JPG , .JpG. This will lead us to:



                    -ilname pattern
                    Like -lname, but the match is case insensitive. If the -L
                    option or the -follow option is in effect, this test returns
                    false unless the symbolic link is broken.


                    However, after you search for lname you will see that this will only search for symbolic links. We want real files. The next entry:



                       -iname pattern
                    Like -name, but the match is case insensitive. For example, the
                    patterns `fo*' and `F??' match the file names `Foo', `FOO',
                    `foo', `fOo', etc. In these patterns, unlike filename expan‐
                    sion by the shell, an initial '.' can be matched by `*'. That
                    is, find -name *bar will match the file `.foobar'. Please note
                    that you should quote patterns as a matter of course, otherwise
                    the shell will expand any wildcard characters in them.


                    Great. I don't even need to read about -name to see that -iname is the case insensitive version of this argument. Lets assemble the command:



                    Command: find /ftp/dir/ -size +500k -iname "*.jpg"



                    What is implicit here: The knowledge that the wildcard ? represents "any character at a single position" and * represents "zero or more of any character". The -name parameter will give you a summary of this knowledge.



                    Tips that apply to all commands



                    Some options, mnemonics and "syntax style" travel through all commands making you buy some time by not having to open the manpage at all. Those are learned by practice and the most common are:




                    • Generally, -v means verbose. -vvv is a variation "very very verbose" on some software.

                    • Following the POSIX standard, generally one dash arguments can be stacked. Example: tar -xzvf, cp -Rv.

                    • Generally -R and/or -r means recursive.

                    • Almost all commands have a brief help with the --help option.


                    • --version shows the version of a software.


                    • -p, on copy or move utilities means "preserve permissions".


                    • -y means YES, or "proceed without confirmation" in most cases.


                    Note that the above are not always true though. For example, the -r switch can mean very different things for different software. It is always a good idea to check and make sure when a command could be dangerous, but these are common defaults.



                    Default values of commands.



                    At the pager chunk of this answer, we saw that less -is is the pager of man. The default behavior of commands are not always shown at a separated section on manpages, or at the section that is most top placed.



                    You will have to read the options to find out defaults, or if you are lucky, typing /pager will lead you to that info. This also requires you to know the concept of the pager(software that scrolls the manpage), and this is a thing you will only acquire after reading lots of manpages.



                    Why is that important? This will open up your perception if you find differences on scroll and color behavior while reading man(1) on Linux(less -is pager) or FreeBSD man(1) for example.



                    And what about the SYNOPSIS syntax?



                    After getting all the information needed to execute the command, you can combine options, option-arguments and operands inline to make your job done. Overview of concepts:




                    • Options are the switches that dictates a command behavior. "Do this"
                      "don't do this" or "act this way". Often called switches.

                    • Option-arguments are used on most cases when an option isn´t
                      binary(on/off) like -t on mount, that specifies the type of a
                      filesystem(-t iso9660, -t ext2). "Do this with closed eyes" or
                      "feed the animals, but only the lions". Also called arguments.

                    • Operands are things you want that command to act upon. If you use
                      cat file.txt, the operand is a file inside your current
                      directory, and it´s contents will be shown on STDOUT. ls is a
                      command where an operand is optional. The three dots after the operand
                      implicitly tells you that cat can act on multiple operands(files) at
                      the same time. You may notice that some commands have set what type of
                      operand it will use. Example: cat [OPTION] [FILE]...


                    Related synopsis stuff:




                    • Understand synopsis in manpage


                    When will this method not work?




                    • Manpages that have no examples

                    • Manpages where options have a short explanation

                    • When you use generic keywords like and, to, for inside the manpages

                    • Manpages that are not installed. It seems to be obvious but, if you don't have lftp (and its manpages) installed you can't know that is a suitable option as a more sophisticated ftp client by running man -k ftp


                    In some cases the examples will be pretty simple, and you will have to make some executions of your command to test, or in a worst case scenario, Google it.



                    Other: Programming languages and it's modules:



                    If you are programming or just creating scripts, keep in mind that some languages have it's own manpages systems, like perl(perldocs), python(pydocs), etc, holding specific information about methods/funcions, variables, behavior, and other important information about the module you are trying to use and learn. This was useful to me when i was creating a script to download unread IMAP emails using the perl Mail::IMAPClient module.



                    You will have to figure out those specific manpages by using man -k or searching online. Examples:



                    [root@host ~]# man -k doc | grep perl
                    perldoc (1) - Look up Perl documentation in Pod format


                    [root@host ~]# perldoc Mail::IMAPClient
                    IMAPCLIENT(1) User Contributed Perl Documentation IMAPCLIENT(1)

                    NAME
                    Mail::IMAPClient - An IMAP Client API

                    SYNOPSIS
                    use Mail::IMAPClient;

                    my $imap = Mail::IMAPClient->new(
                    Server => ’localhost’,
                    User => ’username’,
                    Password => ’password’,
                    Ssl => 1,
                    Uid => 1,
                    );


                    ...tons of other stuff here, with sections like a regular manpage...



                    With python:



                    [root@host ~]# pydoc sys
                    Help on built-in module sys:

                    NAME
                    sys

                    FILE
                    (built-in)

                    MODULE DOCS
                    http://www.python.org/doc/current/lib/module-sys.html

                    DESCRIPTION
                    This module provides access to some objects used or maintained by the
                    interpreter and to functions that interact strongly with the interpreter.
                    ...again, another full-featured manpage with interesting info...


                    Or, the help() funcion inside python shell if you want to read more details of some object:



                    nwildner@host:~$ python3.6
                    Python 3.6.7 (default, Oct 21 2018, 08:08:16)
                    [GCC 8.2.0] on linux
                    Type "help", "copyright", "credits" or "license" for more information.
                    >>> help(round)

                    Help on built-in function round in module builtins:

                    round(...)
                    round(number[, ndigits]) -> number

                    Round a number to a given precision in decimal digits (default 0 digits).
                    This returns an int when called with one argument, otherwise the
                    same type as the number. ndigits may be negative.





                    share|improve this answer























                    • You can also do man find | grep .... I like man command | sed -n '/^[[:space:]]*-/,/^$/p'
                      – mikeserv
                      Apr 1 '15 at 14:48






                    • 6




                      Yup. You can. I was just assuming that the operator is "noob" and trying to get started with manpages :)
                      – nwildner
                      Apr 1 '15 at 14:49






                    • 3




                      This answer needs to be the top result for "How do I effectively use man?" Thank you and well done.
                      – user1717828
                      Apr 1 '15 at 14:58








                    • 8




                      @nwildner, you deserve a candy after such huge and well formated answer. Good job!
                      – Willian Paixao
                      Apr 2 '15 at 4:10






                    • 6




                      I think this should be added to Linux. As a man page of course.
                      – myaut
                      Apr 6 '15 at 22:26













                    up vote
                    97
                    down vote



                    accepted
                    +300







                    up vote
                    97
                    down vote



                    accepted
                    +300




                    +300




                    Well, this is my very personal way to read manpages:



                    The manpager



                    When you open a manpage using the man command, the output will be displayed/rendered by the less or more commands, or any other command that will be set as your pager(manpager).



                    If you are using Linux you are probably served with your man infrastructure already configured to use /usr/bin/less -is (unless you installed some minimal distro) as man(1), explain on it's Options section:



                    -P pager
                    Specify which pager to use. This option overrides the MANPAGER environment variable,
                    which in turn overrides the PAGER variable. By default, man uses /usr/bin/less -is.


                    On FreeBSD and OpenBSD is just a matter of editing the MANPAGER environment variable since they will mostly use more, and some features like search and text highlight could be missing.



                    There is a good answer to the question of what differences more, less and most have here(never used most). The ability to scroll backwards and scroll forward by page with Space or both ways by line with or (also, using vi bindings j and k) is essential while browsing manpages. Press h while using less to see the summary of commands available.



                    And that's why I suggest you to use less as your man pager. less have some essential features that will be used during this answer.



                    How is a command formatted?



                    Utility Conventions: The Open Group Base Specifications Issue 7 - IEEE Std 1003.1, 2013 Edition. You should visit that link before trying to understand a manpage. This online reference describes the argument syntax of the standard utilities and introduces terminology used throughout POSIX.1-2017 for describing the arguments processed by the utilities. This will also indirectly get you updated about the real meaning of words like parameters, arguments, argument option...



                    The head of any manpage will look less cryptic to you after understanding the notation of the utility conventions:



                    utility_name[-a][-b][-c option_argument]
                    [-d|-e][-f[option_argument]][operand...]


                    Have in mind what you want to do.



                    When doing your research about xargs you did it for a purpouse, right? You had a specific need that was reading standard output and executing commands based on that output.



                    But, when I don't know which command I want?



                    Use man -k or apropos (they are equivalent). If I don't know how to find a file: man -k file | grep search. Read the descriptions and find one that will better fit your needs. Example:



                    apropos -r '^report'
                    bashbug (1) - report a bug in bash
                    df (1) - report file system disk space usage
                    e2freefrag (8) - report free space fragmentation information
                    filefrag (8) - report on file fragmentation
                    iwgetid (8) - Report ESSID, NWID or AP/Cell Address of wireless network
                    kbd_mode (1) - report or set the keyboard mode
                    lastlog (8) - reports the most recent login of all users or of a given user
                    pmap (1) - report memory map of a process
                    ps (1) - report a snapshot of the current processes.
                    pwdx (1) - report current working directory of a process
                    uniq (1) - report or omit repeated lines
                    vmstat (8) - Report virtual memory statistics


                    Apropos works with regular expressions by default, (man apropos, read the description and find out what -r does), and on this example I'm looking for every manpage where the description starts with "report".



                    To look for information related with reading standard input/output processing and reaching xargs as a possible option:



                    man -k command| grep input
                    xargs (1) - build and execute command lines from standard input


                    Always read the DESCRIPTION before starting



                    Take a time and read the description. By just reading the description of the xargs command we will learn that:





                    • xargs reads from STDIN and executes the command needed. This also means that you will need to have some knowledge of how standard input works, and how to manipulate it through pipes to chain commands

                    • The default behavior is to act like /bin/echo. This gives you a little tip that if you need to chain more than one xargs, you don't need to use echo to print.

                    • We have also learned that unix filenames can contain blank and newlines, that this could be a problem and the argument -0 is a way to prevent things explode by using null character separators. The description warns you that the command being used as input needs to support this feature too, and that GNU find support it. Great. We use a lot of find with xargs.


                    • xargs will stop if exit status 255 is reached.


                    Some descriptions are very short and that is generally because the software works on a very simple way. Don't even think of skipping this part of the manpage ;)



                    Other things to pay attention...



                    You know that you can search for files using find. There is a ton of options and if you only look at the SYNOPSIS, you will get overwhelmed by those. It's just the tip of the iceberg. Excluding NAME, SYNOPSIS, and DESCRIPTION, you will have the following sections:




                    • AUTHORS: the people who created or assisted in the creation of the
                      command.


                    • BUGS: lists any known defects. Could be only implementation limitations.


                    • ENVIRONMENT: Aspects of your shell that could be affected by the command, or variables that will be used.


                    • EXAMPLES or NOTES: Self explanatory.


                    • REPORTING BUGS: Who you will have to contact if you find bugs on this tool or in its documentation.


                    • COPYRIGHT: Person who created and disclaimers about the software. All related with the license of the software itself.


                    • SEE ALSO: Other commands, tools or working aspects that are related to this command, and could not fit on any of the other sections.



                    You will most probably find interesting info about the aspects you want of a tool on the examples/notes section.



                    Example



                    On the following steps I'll take find as an example, since it's concepts are "more simple" than xargs to explain(one command find files and the other deals with stdin and pipelined execution of other command output). Let's just pretend that we know nothing(or very little) about this command.



                    I have a specific problem that is: I have to look for every file with the .jpg extension, and with 500KiB (KiB = 1024 byte, commonly called kibibyte), or more in size inside a ftp server folder.



                    First, open the manual: man find. The SYNOPSIS is slim. Let's search for things inside the manual: Type / plus the word you want (size). It will index a lot of entries -size that will count specific sizes. Got stuck. Don't know how to search with "more than" or "less than" a given size, and the man does not show that to me.



                    Let's give it a try, and search for the next entry found by hitting n. OK. Found something interesting: find ( -size +100M -fprintf /root/big.txt %-10s %pn ). Maybe this example is showing us that with -size +100M it will find files with 100MB or more. How could I confirm? Going to the head of the manpage and searching for other words.



                    Again, let's try the word greater. Pressing g will lead us to the head of the manpage. /greater, and the first entry is:



                     Numeric arguments can be specified as

                    +n for **greater** than n,

                    -n for less than n,

                    n for exactly n.


                    Sounds great. It seems that this block of the manual confirmed what we suspected. However, this will not only apply to file sizes. It will apply to any n that can be found on this manpage (as the phrase said: "Numeric arguments can be specified as").



                    Good. Let us find a way to filter by name: g /insensitive. Why? Insensitive? Wtf? We have a hypothetical ftp server, where "that other OS" people could give a file name with extensions as .jpg, .JPG , .JpG. This will lead us to:



                    -ilname pattern
                    Like -lname, but the match is case insensitive. If the -L
                    option or the -follow option is in effect, this test returns
                    false unless the symbolic link is broken.


                    However, after you search for lname you will see that this will only search for symbolic links. We want real files. The next entry:



                       -iname pattern
                    Like -name, but the match is case insensitive. For example, the
                    patterns `fo*' and `F??' match the file names `Foo', `FOO',
                    `foo', `fOo', etc. In these patterns, unlike filename expan‐
                    sion by the shell, an initial '.' can be matched by `*'. That
                    is, find -name *bar will match the file `.foobar'. Please note
                    that you should quote patterns as a matter of course, otherwise
                    the shell will expand any wildcard characters in them.


                    Great. I don't even need to read about -name to see that -iname is the case insensitive version of this argument. Lets assemble the command:



                    Command: find /ftp/dir/ -size +500k -iname "*.jpg"



                    What is implicit here: The knowledge that the wildcard ? represents "any character at a single position" and * represents "zero or more of any character". The -name parameter will give you a summary of this knowledge.



                    Tips that apply to all commands



                    Some options, mnemonics and "syntax style" travel through all commands making you buy some time by not having to open the manpage at all. Those are learned by practice and the most common are:




                    • Generally, -v means verbose. -vvv is a variation "very very verbose" on some software.

                    • Following the POSIX standard, generally one dash arguments can be stacked. Example: tar -xzvf, cp -Rv.

                    • Generally -R and/or -r means recursive.

                    • Almost all commands have a brief help with the --help option.


                    • --version shows the version of a software.


                    • -p, on copy or move utilities means "preserve permissions".


                    • -y means YES, or "proceed without confirmation" in most cases.


                    Note that the above are not always true though. For example, the -r switch can mean very different things for different software. It is always a good idea to check and make sure when a command could be dangerous, but these are common defaults.



                    Default values of commands.



                    At the pager chunk of this answer, we saw that less -is is the pager of man. The default behavior of commands are not always shown at a separated section on manpages, or at the section that is most top placed.



                    You will have to read the options to find out defaults, or if you are lucky, typing /pager will lead you to that info. This also requires you to know the concept of the pager(software that scrolls the manpage), and this is a thing you will only acquire after reading lots of manpages.



                    Why is that important? This will open up your perception if you find differences on scroll and color behavior while reading man(1) on Linux(less -is pager) or FreeBSD man(1) for example.



                    And what about the SYNOPSIS syntax?



                    After getting all the information needed to execute the command, you can combine options, option-arguments and operands inline to make your job done. Overview of concepts:




                    • Options are the switches that dictates a command behavior. "Do this"
                      "don't do this" or "act this way". Often called switches.

                    • Option-arguments are used on most cases when an option isn´t
                      binary(on/off) like -t on mount, that specifies the type of a
                      filesystem(-t iso9660, -t ext2). "Do this with closed eyes" or
                      "feed the animals, but only the lions". Also called arguments.

                    • Operands are things you want that command to act upon. If you use
                      cat file.txt, the operand is a file inside your current
                      directory, and it´s contents will be shown on STDOUT. ls is a
                      command where an operand is optional. The three dots after the operand
                      implicitly tells you that cat can act on multiple operands(files) at
                      the same time. You may notice that some commands have set what type of
                      operand it will use. Example: cat [OPTION] [FILE]...


                    Related synopsis stuff:




                    • Understand synopsis in manpage


                    When will this method not work?




                    • Manpages that have no examples

                    • Manpages where options have a short explanation

                    • When you use generic keywords like and, to, for inside the manpages

                    • Manpages that are not installed. It seems to be obvious but, if you don't have lftp (and its manpages) installed you can't know that is a suitable option as a more sophisticated ftp client by running man -k ftp


                    In some cases the examples will be pretty simple, and you will have to make some executions of your command to test, or in a worst case scenario, Google it.



                    Other: Programming languages and it's modules:



                    If you are programming or just creating scripts, keep in mind that some languages have it's own manpages systems, like perl(perldocs), python(pydocs), etc, holding specific information about methods/funcions, variables, behavior, and other important information about the module you are trying to use and learn. This was useful to me when i was creating a script to download unread IMAP emails using the perl Mail::IMAPClient module.



                    You will have to figure out those specific manpages by using man -k or searching online. Examples:



                    [root@host ~]# man -k doc | grep perl
                    perldoc (1) - Look up Perl documentation in Pod format


                    [root@host ~]# perldoc Mail::IMAPClient
                    IMAPCLIENT(1) User Contributed Perl Documentation IMAPCLIENT(1)

                    NAME
                    Mail::IMAPClient - An IMAP Client API

                    SYNOPSIS
                    use Mail::IMAPClient;

                    my $imap = Mail::IMAPClient->new(
                    Server => ’localhost’,
                    User => ’username’,
                    Password => ’password’,
                    Ssl => 1,
                    Uid => 1,
                    );


                    ...tons of other stuff here, with sections like a regular manpage...



                    With python:



                    [root@host ~]# pydoc sys
                    Help on built-in module sys:

                    NAME
                    sys

                    FILE
                    (built-in)

                    MODULE DOCS
                    http://www.python.org/doc/current/lib/module-sys.html

                    DESCRIPTION
                    This module provides access to some objects used or maintained by the
                    interpreter and to functions that interact strongly with the interpreter.
                    ...again, another full-featured manpage with interesting info...


                    Or, the help() funcion inside python shell if you want to read more details of some object:



                    nwildner@host:~$ python3.6
                    Python 3.6.7 (default, Oct 21 2018, 08:08:16)
                    [GCC 8.2.0] on linux
                    Type "help", "copyright", "credits" or "license" for more information.
                    >>> help(round)

                    Help on built-in function round in module builtins:

                    round(...)
                    round(number[, ndigits]) -> number

                    Round a number to a given precision in decimal digits (default 0 digits).
                    This returns an int when called with one argument, otherwise the
                    same type as the number. ndigits may be negative.





                    share|improve this answer














                    Well, this is my very personal way to read manpages:



                    The manpager



                    When you open a manpage using the man command, the output will be displayed/rendered by the less or more commands, or any other command that will be set as your pager(manpager).



                    If you are using Linux you are probably served with your man infrastructure already configured to use /usr/bin/less -is (unless you installed some minimal distro) as man(1), explain on it's Options section:



                    -P pager
                    Specify which pager to use. This option overrides the MANPAGER environment variable,
                    which in turn overrides the PAGER variable. By default, man uses /usr/bin/less -is.


                    On FreeBSD and OpenBSD is just a matter of editing the MANPAGER environment variable since they will mostly use more, and some features like search and text highlight could be missing.



                    There is a good answer to the question of what differences more, less and most have here(never used most). The ability to scroll backwards and scroll forward by page with Space or both ways by line with or (also, using vi bindings j and k) is essential while browsing manpages. Press h while using less to see the summary of commands available.



                    And that's why I suggest you to use less as your man pager. less have some essential features that will be used during this answer.



                    How is a command formatted?



                    Utility Conventions: The Open Group Base Specifications Issue 7 - IEEE Std 1003.1, 2013 Edition. You should visit that link before trying to understand a manpage. This online reference describes the argument syntax of the standard utilities and introduces terminology used throughout POSIX.1-2017 for describing the arguments processed by the utilities. This will also indirectly get you updated about the real meaning of words like parameters, arguments, argument option...



                    The head of any manpage will look less cryptic to you after understanding the notation of the utility conventions:



                    utility_name[-a][-b][-c option_argument]
                    [-d|-e][-f[option_argument]][operand...]


                    Have in mind what you want to do.



                    When doing your research about xargs you did it for a purpouse, right? You had a specific need that was reading standard output and executing commands based on that output.



                    But, when I don't know which command I want?



                    Use man -k or apropos (they are equivalent). If I don't know how to find a file: man -k file | grep search. Read the descriptions and find one that will better fit your needs. Example:



                    apropos -r '^report'
                    bashbug (1) - report a bug in bash
                    df (1) - report file system disk space usage
                    e2freefrag (8) - report free space fragmentation information
                    filefrag (8) - report on file fragmentation
                    iwgetid (8) - Report ESSID, NWID or AP/Cell Address of wireless network
                    kbd_mode (1) - report or set the keyboard mode
                    lastlog (8) - reports the most recent login of all users or of a given user
                    pmap (1) - report memory map of a process
                    ps (1) - report a snapshot of the current processes.
                    pwdx (1) - report current working directory of a process
                    uniq (1) - report or omit repeated lines
                    vmstat (8) - Report virtual memory statistics


                    Apropos works with regular expressions by default, (man apropos, read the description and find out what -r does), and on this example I'm looking for every manpage where the description starts with "report".



                    To look for information related with reading standard input/output processing and reaching xargs as a possible option:



                    man -k command| grep input
                    xargs (1) - build and execute command lines from standard input


                    Always read the DESCRIPTION before starting



                    Take a time and read the description. By just reading the description of the xargs command we will learn that:





                    • xargs reads from STDIN and executes the command needed. This also means that you will need to have some knowledge of how standard input works, and how to manipulate it through pipes to chain commands

                    • The default behavior is to act like /bin/echo. This gives you a little tip that if you need to chain more than one xargs, you don't need to use echo to print.

                    • We have also learned that unix filenames can contain blank and newlines, that this could be a problem and the argument -0 is a way to prevent things explode by using null character separators. The description warns you that the command being used as input needs to support this feature too, and that GNU find support it. Great. We use a lot of find with xargs.


                    • xargs will stop if exit status 255 is reached.


                    Some descriptions are very short and that is generally because the software works on a very simple way. Don't even think of skipping this part of the manpage ;)



                    Other things to pay attention...



                    You know that you can search for files using find. There is a ton of options and if you only look at the SYNOPSIS, you will get overwhelmed by those. It's just the tip of the iceberg. Excluding NAME, SYNOPSIS, and DESCRIPTION, you will have the following sections:




                    • AUTHORS: the people who created or assisted in the creation of the
                      command.


                    • BUGS: lists any known defects. Could be only implementation limitations.


                    • ENVIRONMENT: Aspects of your shell that could be affected by the command, or variables that will be used.


                    • EXAMPLES or NOTES: Self explanatory.


                    • REPORTING BUGS: Who you will have to contact if you find bugs on this tool or in its documentation.


                    • COPYRIGHT: Person who created and disclaimers about the software. All related with the license of the software itself.


                    • SEE ALSO: Other commands, tools or working aspects that are related to this command, and could not fit on any of the other sections.



                    You will most probably find interesting info about the aspects you want of a tool on the examples/notes section.



                    Example



                    On the following steps I'll take find as an example, since it's concepts are "more simple" than xargs to explain(one command find files and the other deals with stdin and pipelined execution of other command output). Let's just pretend that we know nothing(or very little) about this command.



                    I have a specific problem that is: I have to look for every file with the .jpg extension, and with 500KiB (KiB = 1024 byte, commonly called kibibyte), or more in size inside a ftp server folder.



                    First, open the manual: man find. The SYNOPSIS is slim. Let's search for things inside the manual: Type / plus the word you want (size). It will index a lot of entries -size that will count specific sizes. Got stuck. Don't know how to search with "more than" or "less than" a given size, and the man does not show that to me.



                    Let's give it a try, and search for the next entry found by hitting n. OK. Found something interesting: find ( -size +100M -fprintf /root/big.txt %-10s %pn ). Maybe this example is showing us that with -size +100M it will find files with 100MB or more. How could I confirm? Going to the head of the manpage and searching for other words.



                    Again, let's try the word greater. Pressing g will lead us to the head of the manpage. /greater, and the first entry is:



                     Numeric arguments can be specified as

                    +n for **greater** than n,

                    -n for less than n,

                    n for exactly n.


                    Sounds great. It seems that this block of the manual confirmed what we suspected. However, this will not only apply to file sizes. It will apply to any n that can be found on this manpage (as the phrase said: "Numeric arguments can be specified as").



                    Good. Let us find a way to filter by name: g /insensitive. Why? Insensitive? Wtf? We have a hypothetical ftp server, where "that other OS" people could give a file name with extensions as .jpg, .JPG , .JpG. This will lead us to:



                    -ilname pattern
                    Like -lname, but the match is case insensitive. If the -L
                    option or the -follow option is in effect, this test returns
                    false unless the symbolic link is broken.


                    However, after you search for lname you will see that this will only search for symbolic links. We want real files. The next entry:



                       -iname pattern
                    Like -name, but the match is case insensitive. For example, the
                    patterns `fo*' and `F??' match the file names `Foo', `FOO',
                    `foo', `fOo', etc. In these patterns, unlike filename expan‐
                    sion by the shell, an initial '.' can be matched by `*'. That
                    is, find -name *bar will match the file `.foobar'. Please note
                    that you should quote patterns as a matter of course, otherwise
                    the shell will expand any wildcard characters in them.


                    Great. I don't even need to read about -name to see that -iname is the case insensitive version of this argument. Lets assemble the command:



                    Command: find /ftp/dir/ -size +500k -iname "*.jpg"



                    What is implicit here: The knowledge that the wildcard ? represents "any character at a single position" and * represents "zero or more of any character". The -name parameter will give you a summary of this knowledge.



                    Tips that apply to all commands



                    Some options, mnemonics and "syntax style" travel through all commands making you buy some time by not having to open the manpage at all. Those are learned by practice and the most common are:




                    • Generally, -v means verbose. -vvv is a variation "very very verbose" on some software.

                    • Following the POSIX standard, generally one dash arguments can be stacked. Example: tar -xzvf, cp -Rv.

                    • Generally -R and/or -r means recursive.

                    • Almost all commands have a brief help with the --help option.


                    • --version shows the version of a software.


                    • -p, on copy or move utilities means "preserve permissions".


                    • -y means YES, or "proceed without confirmation" in most cases.


                    Note that the above are not always true though. For example, the -r switch can mean very different things for different software. It is always a good idea to check and make sure when a command could be dangerous, but these are common defaults.



                    Default values of commands.



                    At the pager chunk of this answer, we saw that less -is is the pager of man. The default behavior of commands are not always shown at a separated section on manpages, or at the section that is most top placed.



                    You will have to read the options to find out defaults, or if you are lucky, typing /pager will lead you to that info. This also requires you to know the concept of the pager(software that scrolls the manpage), and this is a thing you will only acquire after reading lots of manpages.



                    Why is that important? This will open up your perception if you find differences on scroll and color behavior while reading man(1) on Linux(less -is pager) or FreeBSD man(1) for example.



                    And what about the SYNOPSIS syntax?



                    After getting all the information needed to execute the command, you can combine options, option-arguments and operands inline to make your job done. Overview of concepts:




                    • Options are the switches that dictates a command behavior. "Do this"
                      "don't do this" or "act this way". Often called switches.

                    • Option-arguments are used on most cases when an option isn´t
                      binary(on/off) like -t on mount, that specifies the type of a
                      filesystem(-t iso9660, -t ext2). "Do this with closed eyes" or
                      "feed the animals, but only the lions". Also called arguments.

                    • Operands are things you want that command to act upon. If you use
                      cat file.txt, the operand is a file inside your current
                      directory, and it´s contents will be shown on STDOUT. ls is a
                      command where an operand is optional. The three dots after the operand
                      implicitly tells you that cat can act on multiple operands(files) at
                      the same time. You may notice that some commands have set what type of
                      operand it will use. Example: cat [OPTION] [FILE]...


                    Related synopsis stuff:




                    • Understand synopsis in manpage


                    When will this method not work?




                    • Manpages that have no examples

                    • Manpages where options have a short explanation

                    • When you use generic keywords like and, to, for inside the manpages

                    • Manpages that are not installed. It seems to be obvious but, if you don't have lftp (and its manpages) installed you can't know that is a suitable option as a more sophisticated ftp client by running man -k ftp


                    In some cases the examples will be pretty simple, and you will have to make some executions of your command to test, or in a worst case scenario, Google it.



                    Other: Programming languages and it's modules:



                    If you are programming or just creating scripts, keep in mind that some languages have it's own manpages systems, like perl(perldocs), python(pydocs), etc, holding specific information about methods/funcions, variables, behavior, and other important information about the module you are trying to use and learn. This was useful to me when i was creating a script to download unread IMAP emails using the perl Mail::IMAPClient module.



                    You will have to figure out those specific manpages by using man -k or searching online. Examples:



                    [root@host ~]# man -k doc | grep perl
                    perldoc (1) - Look up Perl documentation in Pod format


                    [root@host ~]# perldoc Mail::IMAPClient
                    IMAPCLIENT(1) User Contributed Perl Documentation IMAPCLIENT(1)

                    NAME
                    Mail::IMAPClient - An IMAP Client API

                    SYNOPSIS
                    use Mail::IMAPClient;

                    my $imap = Mail::IMAPClient->new(
                    Server => ’localhost’,
                    User => ’username’,
                    Password => ’password’,
                    Ssl => 1,
                    Uid => 1,
                    );


                    ...tons of other stuff here, with sections like a regular manpage...



                    With python:



                    [root@host ~]# pydoc sys
                    Help on built-in module sys:

                    NAME
                    sys

                    FILE
                    (built-in)

                    MODULE DOCS
                    http://www.python.org/doc/current/lib/module-sys.html

                    DESCRIPTION
                    This module provides access to some objects used or maintained by the
                    interpreter and to functions that interact strongly with the interpreter.
                    ...again, another full-featured manpage with interesting info...


                    Or, the help() funcion inside python shell if you want to read more details of some object:



                    nwildner@host:~$ python3.6
                    Python 3.6.7 (default, Oct 21 2018, 08:08:16)
                    [GCC 8.2.0] on linux
                    Type "help", "copyright", "credits" or "license" for more information.
                    >>> help(round)

                    Help on built-in function round in module builtins:

                    round(...)
                    round(number[, ndigits]) -> number

                    Round a number to a given precision in decimal digits (default 0 digits).
                    This returns an int when called with one argument, otherwise the
                    same type as the number. ndigits may be negative.






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 21 at 19:29

























                    answered Apr 1 '15 at 14:31









                    nwildner

                    13.8k14075




                    13.8k14075












                    • You can also do man find | grep .... I like man command | sed -n '/^[[:space:]]*-/,/^$/p'
                      – mikeserv
                      Apr 1 '15 at 14:48






                    • 6




                      Yup. You can. I was just assuming that the operator is "noob" and trying to get started with manpages :)
                      – nwildner
                      Apr 1 '15 at 14:49






                    • 3




                      This answer needs to be the top result for "How do I effectively use man?" Thank you and well done.
                      – user1717828
                      Apr 1 '15 at 14:58








                    • 8




                      @nwildner, you deserve a candy after such huge and well formated answer. Good job!
                      – Willian Paixao
                      Apr 2 '15 at 4:10






                    • 6




                      I think this should be added to Linux. As a man page of course.
                      – myaut
                      Apr 6 '15 at 22:26


















                    • You can also do man find | grep .... I like man command | sed -n '/^[[:space:]]*-/,/^$/p'
                      – mikeserv
                      Apr 1 '15 at 14:48






                    • 6




                      Yup. You can. I was just assuming that the operator is "noob" and trying to get started with manpages :)
                      – nwildner
                      Apr 1 '15 at 14:49






                    • 3




                      This answer needs to be the top result for "How do I effectively use man?" Thank you and well done.
                      – user1717828
                      Apr 1 '15 at 14:58








                    • 8




                      @nwildner, you deserve a candy after such huge and well formated answer. Good job!
                      – Willian Paixao
                      Apr 2 '15 at 4:10






                    • 6




                      I think this should be added to Linux. As a man page of course.
                      – myaut
                      Apr 6 '15 at 22:26
















                    You can also do man find | grep .... I like man command | sed -n '/^[[:space:]]*-/,/^$/p'
                    – mikeserv
                    Apr 1 '15 at 14:48




                    You can also do man find | grep .... I like man command | sed -n '/^[[:space:]]*-/,/^$/p'
                    – mikeserv
                    Apr 1 '15 at 14:48




                    6




                    6




                    Yup. You can. I was just assuming that the operator is "noob" and trying to get started with manpages :)
                    – nwildner
                    Apr 1 '15 at 14:49




                    Yup. You can. I was just assuming that the operator is "noob" and trying to get started with manpages :)
                    – nwildner
                    Apr 1 '15 at 14:49




                    3




                    3




                    This answer needs to be the top result for "How do I effectively use man?" Thank you and well done.
                    – user1717828
                    Apr 1 '15 at 14:58






                    This answer needs to be the top result for "How do I effectively use man?" Thank you and well done.
                    – user1717828
                    Apr 1 '15 at 14:58






                    8




                    8




                    @nwildner, you deserve a candy after such huge and well formated answer. Good job!
                    – Willian Paixao
                    Apr 2 '15 at 4:10




                    @nwildner, you deserve a candy after such huge and well formated answer. Good job!
                    – Willian Paixao
                    Apr 2 '15 at 4:10




                    6




                    6




                    I think this should be added to Linux. As a man page of course.
                    – myaut
                    Apr 6 '15 at 22:26




                    I think this should be added to Linux. As a man page of course.
                    – myaut
                    Apr 6 '15 at 22:26












                    up vote
                    37
                    down vote













                    This is quite nicely explained in man man:



                       The following conventions apply to the SYNOPSIS section and can be used
                    as a guide in other sections.

                    bold text type exactly as shown.
                    italic text replace with appropriate argument.
                    [-abc] any or all arguments within [ ] are optional.
                    -a|-b options delimited by | cannot be used together.

                    argument ... argument is repeatable.
                    [expression] ... entire expression within [ ] is repeatable.


                    As for how you're supposed to write a valid command from that, well, you're not. The synopsis is useful once you know how a command works. It can help you refresh your memory. In order to understand how the command works, you should read the man page. Especially the descriptions of the options and the examples section.



                    Sometimes the synopsis is enough. For example, in man ls:



                    SYNOPSIS
                    ls [OPTION]... [FILE]...


                    Other times, it is useless unless you already know how to use the command in question. For example, man dd:



                       dd [OPERAND]...
                    dd OPTION


                    So, in conclusion, don't worry if you don't get the synopsis. That's normal. Read the man page itself.






                    share|improve this answer





















                    • Thank you for the advice, especially the "As for how..." paragraph.
                      – user1717828
                      Apr 1 '15 at 14:59















                    up vote
                    37
                    down vote













                    This is quite nicely explained in man man:



                       The following conventions apply to the SYNOPSIS section and can be used
                    as a guide in other sections.

                    bold text type exactly as shown.
                    italic text replace with appropriate argument.
                    [-abc] any or all arguments within [ ] are optional.
                    -a|-b options delimited by | cannot be used together.

                    argument ... argument is repeatable.
                    [expression] ... entire expression within [ ] is repeatable.


                    As for how you're supposed to write a valid command from that, well, you're not. The synopsis is useful once you know how a command works. It can help you refresh your memory. In order to understand how the command works, you should read the man page. Especially the descriptions of the options and the examples section.



                    Sometimes the synopsis is enough. For example, in man ls:



                    SYNOPSIS
                    ls [OPTION]... [FILE]...


                    Other times, it is useless unless you already know how to use the command in question. For example, man dd:



                       dd [OPERAND]...
                    dd OPTION


                    So, in conclusion, don't worry if you don't get the synopsis. That's normal. Read the man page itself.






                    share|improve this answer





















                    • Thank you for the advice, especially the "As for how..." paragraph.
                      – user1717828
                      Apr 1 '15 at 14:59













                    up vote
                    37
                    down vote










                    up vote
                    37
                    down vote









                    This is quite nicely explained in man man:



                       The following conventions apply to the SYNOPSIS section and can be used
                    as a guide in other sections.

                    bold text type exactly as shown.
                    italic text replace with appropriate argument.
                    [-abc] any or all arguments within [ ] are optional.
                    -a|-b options delimited by | cannot be used together.

                    argument ... argument is repeatable.
                    [expression] ... entire expression within [ ] is repeatable.


                    As for how you're supposed to write a valid command from that, well, you're not. The synopsis is useful once you know how a command works. It can help you refresh your memory. In order to understand how the command works, you should read the man page. Especially the descriptions of the options and the examples section.



                    Sometimes the synopsis is enough. For example, in man ls:



                    SYNOPSIS
                    ls [OPTION]... [FILE]...


                    Other times, it is useless unless you already know how to use the command in question. For example, man dd:



                       dd [OPERAND]...
                    dd OPTION


                    So, in conclusion, don't worry if you don't get the synopsis. That's normal. Read the man page itself.






                    share|improve this answer












                    This is quite nicely explained in man man:



                       The following conventions apply to the SYNOPSIS section and can be used
                    as a guide in other sections.

                    bold text type exactly as shown.
                    italic text replace with appropriate argument.
                    [-abc] any or all arguments within [ ] are optional.
                    -a|-b options delimited by | cannot be used together.

                    argument ... argument is repeatable.
                    [expression] ... entire expression within [ ] is repeatable.


                    As for how you're supposed to write a valid command from that, well, you're not. The synopsis is useful once you know how a command works. It can help you refresh your memory. In order to understand how the command works, you should read the man page. Especially the descriptions of the options and the examples section.



                    Sometimes the synopsis is enough. For example, in man ls:



                    SYNOPSIS
                    ls [OPTION]... [FILE]...


                    Other times, it is useless unless you already know how to use the command in question. For example, man dd:



                       dd [OPERAND]...
                    dd OPTION


                    So, in conclusion, don't worry if you don't get the synopsis. That's normal. Read the man page itself.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 1 '15 at 13:16









                    terdon

                    126k31243418




                    126k31243418












                    • Thank you for the advice, especially the "As for how..." paragraph.
                      – user1717828
                      Apr 1 '15 at 14:59


















                    • Thank you for the advice, especially the "As for how..." paragraph.
                      – user1717828
                      Apr 1 '15 at 14:59
















                    Thank you for the advice, especially the "As for how..." paragraph.
                    – user1717828
                    Apr 1 '15 at 14:59




                    Thank you for the advice, especially the "As for how..." paragraph.
                    – user1717828
                    Apr 1 '15 at 14:59










                    up vote
                    21
                    down vote













                    Some basics to understand synopsis




                    • each [foo] represent optional argument or parameter.

                    • when [foo [ bar ] ] syntax is used, you may use foo, and you may add bar.

                    • mandatory option parameter are used this way [ -S size ] , which tell that -S argument is waiting for a mandatory size.


                    For instance : foo [-S size ] filename ...



                    means




                    • command is foo

                    • optional paramter -S can be use, you have to tell size (name give you a hint)

                    • mandatory argument is filename (this give you an hint also, see man mkdir )

                    • elipsis ... tell you you can use multiple file.


                    You still have to go in depth of man page to understand option (in my sample case above, what -S size is about )






                    share|improve this answer



























                      up vote
                      21
                      down vote













                      Some basics to understand synopsis




                      • each [foo] represent optional argument or parameter.

                      • when [foo [ bar ] ] syntax is used, you may use foo, and you may add bar.

                      • mandatory option parameter are used this way [ -S size ] , which tell that -S argument is waiting for a mandatory size.


                      For instance : foo [-S size ] filename ...



                      means




                      • command is foo

                      • optional paramter -S can be use, you have to tell size (name give you a hint)

                      • mandatory argument is filename (this give you an hint also, see man mkdir )

                      • elipsis ... tell you you can use multiple file.


                      You still have to go in depth of man page to understand option (in my sample case above, what -S size is about )






                      share|improve this answer

























                        up vote
                        21
                        down vote










                        up vote
                        21
                        down vote









                        Some basics to understand synopsis




                        • each [foo] represent optional argument or parameter.

                        • when [foo [ bar ] ] syntax is used, you may use foo, and you may add bar.

                        • mandatory option parameter are used this way [ -S size ] , which tell that -S argument is waiting for a mandatory size.


                        For instance : foo [-S size ] filename ...



                        means




                        • command is foo

                        • optional paramter -S can be use, you have to tell size (name give you a hint)

                        • mandatory argument is filename (this give you an hint also, see man mkdir )

                        • elipsis ... tell you you can use multiple file.


                        You still have to go in depth of man page to understand option (in my sample case above, what -S size is about )






                        share|improve this answer














                        Some basics to understand synopsis




                        • each [foo] represent optional argument or parameter.

                        • when [foo [ bar ] ] syntax is used, you may use foo, and you may add bar.

                        • mandatory option parameter are used this way [ -S size ] , which tell that -S argument is waiting for a mandatory size.


                        For instance : foo [-S size ] filename ...



                        means




                        • command is foo

                        • optional paramter -S can be use, you have to tell size (name give you a hint)

                        • mandatory argument is filename (this give you an hint also, see man mkdir )

                        • elipsis ... tell you you can use multiple file.


                        You still have to go in depth of man page to understand option (in my sample case above, what -S size is about )







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Apr 1 '15 at 14:07









                        rolinger

                        1032




                        1032










                        answered Apr 1 '15 at 13:03









                        Archemar

                        19.4k93468




                        19.4k93468






















                            up vote
                            14
                            down vote













                            man pages normally are displayed with less nowadays. That makes it possible to search through them. I would not bother with the synopsis, especially not because you have a particular commandline that you want to understand.



                            Hit the / and start typing -I and then Enter. The first hit will be in the synopsis, the second (use n for next) gets you the detailed explanation for -I.






                            share|improve this answer

























                              up vote
                              14
                              down vote













                              man pages normally are displayed with less nowadays. That makes it possible to search through them. I would not bother with the synopsis, especially not because you have a particular commandline that you want to understand.



                              Hit the / and start typing -I and then Enter. The first hit will be in the synopsis, the second (use n for next) gets you the detailed explanation for -I.






                              share|improve this answer























                                up vote
                                14
                                down vote










                                up vote
                                14
                                down vote









                                man pages normally are displayed with less nowadays. That makes it possible to search through them. I would not bother with the synopsis, especially not because you have a particular commandline that you want to understand.



                                Hit the / and start typing -I and then Enter. The first hit will be in the synopsis, the second (use n for next) gets you the detailed explanation for -I.






                                share|improve this answer












                                man pages normally are displayed with less nowadays. That makes it possible to search through them. I would not bother with the synopsis, especially not because you have a particular commandline that you want to understand.



                                Hit the / and start typing -I and then Enter. The first hit will be in the synopsis, the second (use n for next) gets you the detailed explanation for -I.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Apr 1 '15 at 13:03









                                Anthon

                                59.8k17102163




                                59.8k17102163






















                                    up vote
                                    11
                                    down vote













                                    One key thing to remember is that you cannot only look at the manual for one command, in the case of commands that execute other commands.



                                    For your example command



                                    locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


                                    You need information on not only xargs but also bash and [ (this may be in the test manpage). You may also need information on your shell (probably also bash) for the quoting rules, since your command includes a complex quoted string. I can already tell you that the quoted argument is wrong (and wrong in a way that will only show up when you encounter a file with spaces in the name); the inner "{}" should probably be '{}'.



                                    So first you would refer to the xargs manpage and see [-I replace-str] for what -I {} means, and [command [initial-arguments]] for what bash and everything after it means. Then you would refer to the bash manpage for what -c does, etc.






                                    share|improve this answer

























                                      up vote
                                      11
                                      down vote













                                      One key thing to remember is that you cannot only look at the manual for one command, in the case of commands that execute other commands.



                                      For your example command



                                      locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


                                      You need information on not only xargs but also bash and [ (this may be in the test manpage). You may also need information on your shell (probably also bash) for the quoting rules, since your command includes a complex quoted string. I can already tell you that the quoted argument is wrong (and wrong in a way that will only show up when you encounter a file with spaces in the name); the inner "{}" should probably be '{}'.



                                      So first you would refer to the xargs manpage and see [-I replace-str] for what -I {} means, and [command [initial-arguments]] for what bash and everything after it means. Then you would refer to the bash manpage for what -c does, etc.






                                      share|improve this answer























                                        up vote
                                        11
                                        down vote










                                        up vote
                                        11
                                        down vote









                                        One key thing to remember is that you cannot only look at the manual for one command, in the case of commands that execute other commands.



                                        For your example command



                                        locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


                                        You need information on not only xargs but also bash and [ (this may be in the test manpage). You may also need information on your shell (probably also bash) for the quoting rules, since your command includes a complex quoted string. I can already tell you that the quoted argument is wrong (and wrong in a way that will only show up when you encounter a file with spaces in the name); the inner "{}" should probably be '{}'.



                                        So first you would refer to the xargs manpage and see [-I replace-str] for what -I {} means, and [command [initial-arguments]] for what bash and everything after it means. Then you would refer to the bash manpage for what -c does, etc.






                                        share|improve this answer












                                        One key thing to remember is that you cannot only look at the manual for one command, in the case of commands that execute other commands.



                                        For your example command



                                        locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"


                                        You need information on not only xargs but also bash and [ (this may be in the test manpage). You may also need information on your shell (probably also bash) for the quoting rules, since your command includes a complex quoted string. I can already tell you that the quoted argument is wrong (and wrong in a way that will only show up when you encounter a file with spaces in the name); the inner "{}" should probably be '{}'.



                                        So first you would refer to the xargs manpage and see [-I replace-str] for what -I {} means, and [command [initial-arguments]] for what bash and everything after it means. Then you would refer to the bash manpage for what -c does, etc.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Apr 1 '15 at 16:08









                                        Random832

                                        8,38012235




                                        8,38012235






















                                            up vote
                                            6
                                            down vote













                                            Adding on to the great answers already given:



                                            1) If you're interested in a gnu utility, especially ones like sed and grep, sometimes, using the info command will bring up a greatly expanded version of the command information. sed, for instance, has a detailed section on how to write regular expressions and another section with some very complex usage examples.



                                            2) It's a "manual". A manual is primarily designed to help you remember the details of something you already understand. It's designed so you can get the details you need quickly and get out. (And way too many have no usage examples or only trivial ones.)



                                            When I need to learn something new, even a small feature of a command that isn't clear to me, I go to the web and search using the best keywords I can think of (e.g. Linux xargs) and add the word howto, examples, or tutorial. This is very often quite productive.



                                            I usually use duckduckgo because it maintains my privacy, but if I need more control of my searches, I use Google because I can tell it just to search within one website or to only return results from the last year. (It has many other Advanced Search options. You can Google them. ;) )



                                            Another tip:



                                            For commands I reference often, I save the man page in a text file



                                            man bash > bashman.txt


                                            and load that file into another window in my text editor so I can flip back and forth, copy and paste, etc.. I usually make the file read only, so I don't end up mangling it by accident, but since it's my personal copy, I could edit it in any way I want to, adding tags so I can find a section more easily or even adding my own notes or examples.



                                            The only drawback to this is that the original man page may be updated and my copy is static.






                                            share|improve this answer



























                                              up vote
                                              6
                                              down vote













                                              Adding on to the great answers already given:



                                              1) If you're interested in a gnu utility, especially ones like sed and grep, sometimes, using the info command will bring up a greatly expanded version of the command information. sed, for instance, has a detailed section on how to write regular expressions and another section with some very complex usage examples.



                                              2) It's a "manual". A manual is primarily designed to help you remember the details of something you already understand. It's designed so you can get the details you need quickly and get out. (And way too many have no usage examples or only trivial ones.)



                                              When I need to learn something new, even a small feature of a command that isn't clear to me, I go to the web and search using the best keywords I can think of (e.g. Linux xargs) and add the word howto, examples, or tutorial. This is very often quite productive.



                                              I usually use duckduckgo because it maintains my privacy, but if I need more control of my searches, I use Google because I can tell it just to search within one website or to only return results from the last year. (It has many other Advanced Search options. You can Google them. ;) )



                                              Another tip:



                                              For commands I reference often, I save the man page in a text file



                                              man bash > bashman.txt


                                              and load that file into another window in my text editor so I can flip back and forth, copy and paste, etc.. I usually make the file read only, so I don't end up mangling it by accident, but since it's my personal copy, I could edit it in any way I want to, adding tags so I can find a section more easily or even adding my own notes or examples.



                                              The only drawback to this is that the original man page may be updated and my copy is static.






                                              share|improve this answer

























                                                up vote
                                                6
                                                down vote










                                                up vote
                                                6
                                                down vote









                                                Adding on to the great answers already given:



                                                1) If you're interested in a gnu utility, especially ones like sed and grep, sometimes, using the info command will bring up a greatly expanded version of the command information. sed, for instance, has a detailed section on how to write regular expressions and another section with some very complex usage examples.



                                                2) It's a "manual". A manual is primarily designed to help you remember the details of something you already understand. It's designed so you can get the details you need quickly and get out. (And way too many have no usage examples or only trivial ones.)



                                                When I need to learn something new, even a small feature of a command that isn't clear to me, I go to the web and search using the best keywords I can think of (e.g. Linux xargs) and add the word howto, examples, or tutorial. This is very often quite productive.



                                                I usually use duckduckgo because it maintains my privacy, but if I need more control of my searches, I use Google because I can tell it just to search within one website or to only return results from the last year. (It has many other Advanced Search options. You can Google them. ;) )



                                                Another tip:



                                                For commands I reference often, I save the man page in a text file



                                                man bash > bashman.txt


                                                and load that file into another window in my text editor so I can flip back and forth, copy and paste, etc.. I usually make the file read only, so I don't end up mangling it by accident, but since it's my personal copy, I could edit it in any way I want to, adding tags so I can find a section more easily or even adding my own notes or examples.



                                                The only drawback to this is that the original man page may be updated and my copy is static.






                                                share|improve this answer














                                                Adding on to the great answers already given:



                                                1) If you're interested in a gnu utility, especially ones like sed and grep, sometimes, using the info command will bring up a greatly expanded version of the command information. sed, for instance, has a detailed section on how to write regular expressions and another section with some very complex usage examples.



                                                2) It's a "manual". A manual is primarily designed to help you remember the details of something you already understand. It's designed so you can get the details you need quickly and get out. (And way too many have no usage examples or only trivial ones.)



                                                When I need to learn something new, even a small feature of a command that isn't clear to me, I go to the web and search using the best keywords I can think of (e.g. Linux xargs) and add the word howto, examples, or tutorial. This is very often quite productive.



                                                I usually use duckduckgo because it maintains my privacy, but if I need more control of my searches, I use Google because I can tell it just to search within one website or to only return results from the last year. (It has many other Advanced Search options. You can Google them. ;) )



                                                Another tip:



                                                For commands I reference often, I save the man page in a text file



                                                man bash > bashman.txt


                                                and load that file into another window in my text editor so I can flip back and forth, copy and paste, etc.. I usually make the file read only, so I don't end up mangling it by accident, but since it's my personal copy, I could edit it in any way I want to, adding tags so I can find a section more easily or even adding my own notes or examples.



                                                The only drawback to this is that the original man page may be updated and my copy is static.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Apr 8 '15 at 0:46

























                                                answered Apr 4 '15 at 1:30









                                                Joe

                                                935816




                                                935816






















                                                    up vote
                                                    4
                                                    down vote













                                                    To get a quick help with your specific command, you can use Explain Shell. E.g. your command. After getting the first high-level understanding how this works, you should proceed with manpages as other answers recommend.






                                                    share|improve this answer

























                                                      up vote
                                                      4
                                                      down vote













                                                      To get a quick help with your specific command, you can use Explain Shell. E.g. your command. After getting the first high-level understanding how this works, you should proceed with manpages as other answers recommend.






                                                      share|improve this answer























                                                        up vote
                                                        4
                                                        down vote










                                                        up vote
                                                        4
                                                        down vote









                                                        To get a quick help with your specific command, you can use Explain Shell. E.g. your command. After getting the first high-level understanding how this works, you should proceed with manpages as other answers recommend.






                                                        share|improve this answer












                                                        To get a quick help with your specific command, you can use Explain Shell. E.g. your command. After getting the first high-level understanding how this works, you should proceed with manpages as other answers recommend.







                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered Apr 3 '15 at 3:26









                                                        AvImd

                                                        535




                                                        535






















                                                            up vote
                                                            2
                                                            down vote













                                                            There are tow useful tools to learn more about the linux commands:





                                                            1. cheat will display the frequently used option for a command line. Also you can add your own command + option to be displayed through cheat for a specific command.


                                                            2. bropages tool provides some example for a command line , it is possible to add you own example or upvote / downvote the given example after getting the verification code through bro thanks. The must voted command will appear on the top of the bro page.






                                                            share|improve this answer

























                                                              up vote
                                                              2
                                                              down vote













                                                              There are tow useful tools to learn more about the linux commands:





                                                              1. cheat will display the frequently used option for a command line. Also you can add your own command + option to be displayed through cheat for a specific command.


                                                              2. bropages tool provides some example for a command line , it is possible to add you own example or upvote / downvote the given example after getting the verification code through bro thanks. The must voted command will appear on the top of the bro page.






                                                              share|improve this answer























                                                                up vote
                                                                2
                                                                down vote










                                                                up vote
                                                                2
                                                                down vote









                                                                There are tow useful tools to learn more about the linux commands:





                                                                1. cheat will display the frequently used option for a command line. Also you can add your own command + option to be displayed through cheat for a specific command.


                                                                2. bropages tool provides some example for a command line , it is possible to add you own example or upvote / downvote the given example after getting the verification code through bro thanks. The must voted command will appear on the top of the bro page.






                                                                share|improve this answer












                                                                There are tow useful tools to learn more about the linux commands:





                                                                1. cheat will display the frequently used option for a command line. Also you can add your own command + option to be displayed through cheat for a specific command.


                                                                2. bropages tool provides some example for a command line , it is possible to add you own example or upvote / downvote the given example after getting the verification code through bro thanks. The must voted command will appear on the top of the bro page.







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered May 4 at 17:02









                                                                GAD3R

                                                                24.5k1749103




                                                                24.5k1749103






















                                                                    up vote
                                                                    1
                                                                    down vote













                                                                    I suggest tldr for a comprehensive man-alike tool. Simplified and community-driven man pages. In ubuntu you can install it via snap, but it has versions for other distros as well. It also provides you with several common example uses. 100% recomended.






                                                                    share|improve this answer

























                                                                      up vote
                                                                      1
                                                                      down vote













                                                                      I suggest tldr for a comprehensive man-alike tool. Simplified and community-driven man pages. In ubuntu you can install it via snap, but it has versions for other distros as well. It also provides you with several common example uses. 100% recomended.






                                                                      share|improve this answer























                                                                        up vote
                                                                        1
                                                                        down vote










                                                                        up vote
                                                                        1
                                                                        down vote









                                                                        I suggest tldr for a comprehensive man-alike tool. Simplified and community-driven man pages. In ubuntu you can install it via snap, but it has versions for other distros as well. It also provides you with several common example uses. 100% recomended.






                                                                        share|improve this answer












                                                                        I suggest tldr for a comprehensive man-alike tool. Simplified and community-driven man pages. In ubuntu you can install it via snap, but it has versions for other distros as well. It also provides you with several common example uses. 100% recomended.







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered May 4 at 15:57









                                                                        José Castillo Lema

                                                                        25119




                                                                        25119






















                                                                            up vote
                                                                            0
                                                                            down vote













                                                                            > I am looking for help interpreting a man page to understand complicated commands.



                                                                            I think that's the misunderstanding here. What makes Linux/UNIX so powerful is that you can construct very long and effective commands by e.g. redirecting the stdout of one command (here, locate) to the stdin of another (here, xargs) through a pipe (|). Hence, as Random832 correctly said, you won't find a single manpage that explains what your example command does.



                                                                            I recommend that you read a Linux shell scripting guide; the Advanced Bash-Scripting Guide is an excellent document. Please don't be intimidated by it; mastering Linux requires years and is a never-ending process, but you can learn the basics in a reasonable amount of time.



                                                                            Then, refer to manpages when you need to know the details of a specific command.



                                                                            Once you've got the gist of it, Commandlinefu and Bash One-Liners are also worth reading to get good examples.






                                                                            share|improve this answer



























                                                                              up vote
                                                                              0
                                                                              down vote













                                                                              > I am looking for help interpreting a man page to understand complicated commands.



                                                                              I think that's the misunderstanding here. What makes Linux/UNIX so powerful is that you can construct very long and effective commands by e.g. redirecting the stdout of one command (here, locate) to the stdin of another (here, xargs) through a pipe (|). Hence, as Random832 correctly said, you won't find a single manpage that explains what your example command does.



                                                                              I recommend that you read a Linux shell scripting guide; the Advanced Bash-Scripting Guide is an excellent document. Please don't be intimidated by it; mastering Linux requires years and is a never-ending process, but you can learn the basics in a reasonable amount of time.



                                                                              Then, refer to manpages when you need to know the details of a specific command.



                                                                              Once you've got the gist of it, Commandlinefu and Bash One-Liners are also worth reading to get good examples.






                                                                              share|improve this answer

























                                                                                up vote
                                                                                0
                                                                                down vote










                                                                                up vote
                                                                                0
                                                                                down vote









                                                                                > I am looking for help interpreting a man page to understand complicated commands.



                                                                                I think that's the misunderstanding here. What makes Linux/UNIX so powerful is that you can construct very long and effective commands by e.g. redirecting the stdout of one command (here, locate) to the stdin of another (here, xargs) through a pipe (|). Hence, as Random832 correctly said, you won't find a single manpage that explains what your example command does.



                                                                                I recommend that you read a Linux shell scripting guide; the Advanced Bash-Scripting Guide is an excellent document. Please don't be intimidated by it; mastering Linux requires years and is a never-ending process, but you can learn the basics in a reasonable amount of time.



                                                                                Then, refer to manpages when you need to know the details of a specific command.



                                                                                Once you've got the gist of it, Commandlinefu and Bash One-Liners are also worth reading to get good examples.






                                                                                share|improve this answer














                                                                                > I am looking for help interpreting a man page to understand complicated commands.



                                                                                I think that's the misunderstanding here. What makes Linux/UNIX so powerful is that you can construct very long and effective commands by e.g. redirecting the stdout of one command (here, locate) to the stdin of another (here, xargs) through a pipe (|). Hence, as Random832 correctly said, you won't find a single manpage that explains what your example command does.



                                                                                I recommend that you read a Linux shell scripting guide; the Advanced Bash-Scripting Guide is an excellent document. Please don't be intimidated by it; mastering Linux requires years and is a never-ending process, but you can learn the basics in a reasonable amount of time.



                                                                                Then, refer to manpages when you need to know the details of a specific command.



                                                                                Once you've got the gist of it, Commandlinefu and Bash One-Liners are also worth reading to get good examples.







                                                                                share|improve this answer














                                                                                share|improve this answer



                                                                                share|improve this answer








                                                                                edited Dec 21 '16 at 12:58

























                                                                                answered Apr 8 '15 at 7:56









                                                                                dr01

                                                                                15.8k114870




                                                                                15.8k114870






















                                                                                    up vote
                                                                                    -1
                                                                                    down vote













                                                                                    To search for something particular in commands in a man page, you can use:



                                                                                    man echo | grep output.


                                                                                    But to search for switches (for example -n), you have to use it this way:



                                                                                    man echo | grep -- -n





                                                                                    share|improve this answer



























                                                                                      up vote
                                                                                      -1
                                                                                      down vote













                                                                                      To search for something particular in commands in a man page, you can use:



                                                                                      man echo | grep output.


                                                                                      But to search for switches (for example -n), you have to use it this way:



                                                                                      man echo | grep -- -n





                                                                                      share|improve this answer

























                                                                                        up vote
                                                                                        -1
                                                                                        down vote










                                                                                        up vote
                                                                                        -1
                                                                                        down vote









                                                                                        To search for something particular in commands in a man page, you can use:



                                                                                        man echo | grep output.


                                                                                        But to search for switches (for example -n), you have to use it this way:



                                                                                        man echo | grep -- -n





                                                                                        share|improve this answer














                                                                                        To search for something particular in commands in a man page, you can use:



                                                                                        man echo | grep output.


                                                                                        But to search for switches (for example -n), you have to use it this way:



                                                                                        man echo | grep -- -n






                                                                                        share|improve this answer














                                                                                        share|improve this answer



                                                                                        share|improve this answer








                                                                                        edited Sep 9 '17 at 18:26









                                                                                        sebasth

                                                                                        7,87831845




                                                                                        7,87831845










                                                                                        answered Sep 9 '17 at 18:24









                                                                                        subtleseeker

                                                                                        166




                                                                                        166

















                                                                                            protected by Kusalananda Sep 9 '17 at 18:27



                                                                                            Thank you for your interest in this question.
                                                                                            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                                                            Would you like to answer one of these unanswered questions instead?



                                                                                            Popular posts from this blog

                                                                                            Accessing regular linux commands in Huawei's Dopra Linux

                                                                                            Can't connect RFCOMM socket: Host is down

                                                                                            Kernel panic - not syncing: Fatal Exception in Interrupt