-2

If i run grep user /etc/passwd, i get the string user:x:1021:1021::/home/user:/bin/bash. What does the numbers "1021:1021" mean? And is there a offline way to find what these mean? If i do man passwd i get information about the command, not the file

1 Answers1

5

man 5 passwd:

/etc/passwd contains one line for each user account, with seven fields delimited by colons (“:”). These fields are:

  • login name
  • optional encrypted password
  • numerical user ID
  • numerical group ID
  • user name or comment field
  • user home directory
  • optional user command interpreter

Well, that's pretty much it.

(man7.org has two versions of that man page, the above is the one I had on Debian. Luckily, there's really no variation in the contents of passwd or shadow, at least on Linuxen, I think. )


The meaning of that 5 is described by e.g. the man page for man itself, it tells that the manual "sections" are:

1   Executable programs or shell commands
2   System calls (functions provided by the kernel)
3   Library calls (functions within program libraries)
4   Special files (usually found in /dev)
5   File formats and conventions eg /etc/passwd
6   Games
7   Miscellaneous (including macro packages and conventions),
    e.g. man(7), groff(7)
8   System administration commands (usually only for root)

You're looking for the file passwd, so section 5 it is.

crontab is similar that it's a command (crontab(1)) and a file (crontab(5)). Also, open appears to have man pages for a command (in Linux, alias for openvt(1)), a system call (open(2)), and a Perl pragma (open(3perl)). Section numbers with tailing text like 3perl are also somewhat common.

Use whatis foo to find out if there's more than one match:

$ whatis passwd
passwd (1)           - change user password
passwd (1ssl)        - compute password hashes
passwd (5)           - the password file

(oh, right, there's also openssl passwd)

Then there's apropos, which "[searches] the manual page names and descriptions". Usually giving a lot more hits.

See also: What do the numbers in a man page mean?


If you have multiple chapters where the same command/config file appears, this is usually mentioned in the man page. E.g. at the bottom of man passwd one will find

SEE ALSO

chpasswd(8), passwd(5), shadow(5), usermod(8).

hinting to a chapter 5 entry for passwd. And in reverse man 5 passwd has

SEE ALSO

crypt(3), getent(1), getpwnam(3), login(1), passwd(1), pwck(8), pwconv(8), pwunconv(8), shadow(5), su(1), sulogin(8).

ilkkachu
  • 138,973
  • 1
    Not to forget the alternative to man: info - which (for some applications) is a bit more detailed and has hyperlinks in the text allowing one to jump to another page. E.g. when info man talks about man's --ascii option and links to what ASCII is. – FelixJN Mar 03 '21 at 12:43
  • @FelixJN, yes, info is particularly relevant with GNU tools, where the man pages sometimes omit all the interesting stuff. (Or are just made as stubs by third parties, e.g. I think Debian has done that so that everything would have at least some man page.) Luckily, the GNU documentation is usually available online too, so there's not so much need to look at info. – ilkkachu Mar 03 '21 at 12:49