Find the answer to your Linux question:
Results 1 to 7 of 7
This is really bugging me and I'm sure the answer is so trivial! Using the command line help, or manuals, it sometimes shows a number in parentheses immediately after a ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Location
    South East England
    Posts
    40

    Trouble RTFM

    This is really bugging me and I'm sure the answer is so trivial!

    Using the command line help, or manuals, it sometimes shows a number in parentheses immediately after a command - is this simply some sort of reference number? I thought at first it was telling me something about parameters I had to pass in!

    For instance looking at the Git manual page, it shows ...

    git(1) Manual Page

    ... and then further down looking at the sub commands it has stuff like ...

    git-add(1)

    git-branch(1)

    etc, etc

    I'm pretty sure I've seen this help syntax on stuff other than Git, and the number in brackets is not always 1.

    It would be useful to know what this is on about please.

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Manpages are grouped into sections. The number refers to the section number. A command can be in more than one section so the 'man' command allows you specify the section. In your example,

    git-branch(1)

    you could look at the manpage with:

    # man 1 git-branch

  3. #3
    Just Joined!
    Join Date
    Apr 2009
    Location
    Alabama
    Posts
    5
    If you do a 'man man' it will give you a man of the man itself. In there, you will see all of the available section numbers (under the Description heading) as well as all the man information you could ever want.

  4. #4
    Just Joined!
    Join Date
    Apr 2009
    Location
    South East England
    Posts
    40
    Never occured to me to try man man! Nor that the same command might be in multiple sections of the manual. All makes sense now.

    Many thanks.

  5. #5
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    In most cases, it isn't actually the same command in multiple sections. Instead, it's things that are named the same. For instance, printf(1) is the printf program that you run from the shell. printf(3), on the other hand, is the printf function that is a part of the standard C library.

    You can use "man -k TERM" to see every man page with that term in the title, and choose the appropriate one.
    DISTRO=Arch
    Registered Linux User #388732

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Quote Originally Posted by PastAsNew View Post
    Never occured to me to try man man! Nor that the same command might be in multiple sections of the manual. All makes sense now.

    Many thanks.
    Well, there are some system commands that have the same name as library functions. Each will be in a different section, so if you just execute "man printf", you will get the printf page from section 1 which is a system command to be used in shell scripts, but if you want the C API printf() man page, you would use "man 3 printf". Two very different beasts!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Quote Originally Posted by Cabhan View Post
    In most cases, it isn't actually the same command in multiple sections. Instead, it's things that are named the same. For instance, printf(1) is the printf program that you run from the shell. printf(3), on the other hand, is the printf function that is a part of the standard C library.

    You can use "man -k TERM" to see every man page with that term in the title, and choose the appropriate one.
    Didn't phrase my post too well. I was thinking of 'crontab' at the time. crontab(1) gives you the command and crontab(5) gives you the format of the crontab file which is accessed by the crontab command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...