0

I am quite new to Linux and I have started learning it. There is a topi in the book about the Man pages and there are sections in man pages. I am trying to understand it but it goes over my head.

When I type passwd(5) in terminal it says syntax error. So I want to understand what is section mean in man pages

enter image description here

3
3

As a new user, an orientation may be useful. I won't try to provide that orientation in this short space, but perhaps I can explain some of the basics and provide some references that will get you started.

First - man is simply a command in Linux/Unix. Its function is to display documentation relevant to another command. For example, man ls will display documentation for the ls command. Wikipedia has a decent article on man page that provides some history, and a glimpse at what goes on "behind the scenes". It's probably worth a few minutes of your time to read this article.

Second - As you've noted, man pages are divided into sections. However, most man pages do not have all of these sections. In general, a man page will have only those sections that are appropriate to the command - most man pages have only one or two sections. You can usually learn what sections are available for a man page using this command:

man -f <command>

# for example: 
man -f mount
mount (8)            - mount a filesystem
mount (2)            - mount filesystem

Third - You will learn how to use man pages through a combination of reading and practicing. The ideal place to start is to open a terminal, and enter the following:

man man

Yes - there is a man page about the man command! This will explain the various options and arguments available. N.B. the documentation in a man page will not always be completely clear to you! This is why practice is important.

Finally - Searching the Internet is usually a productive method for getting answers to specific questions, or finding tutorials and examples. For example, this search on how to use linux manuals turned up this potentially useful Linux man Tutorial. When searching, you should remember that Unix/Linux is an diverse area of practice that is constantly changing. It happens frequently that users find out-of-date information and deprecated resources. There is no magic rule to avoid that, but it often helps to check the publication or revision date of the article and perhaps the relevant distribution (i.e. Ubuntu, CentOS, etc) to find information most relevant to your use case.

And speaking of searching: There is one other command closely related to man that you should learn - the sooner the better. That command is apropos... and as usual, learn more with man apropos!

4
  • "man pages are divided into sections" can be confusing because we are talking about the manual's sections (1, 2, ...), while man man itself also uses the term "section" in relation to a manual page to refer to its paragraphs (NAME, SYNOPSIS, ...). – fra-san Sep 21 '20 at 10:06
  • @fra-san: Apparently so! I wish the semantics didn't obfuscate things. As for me, I would call NAME, SYNOPSIS, etc paragraphs or chapters, or something - anything but sections. When are you going to fix that? :) Seriously though - it's a very good point, but I'm a bit reluctant to add it to the answer here just because it is so awkward. I think I'd prefer to hope readers read these comments also. – Seamus Sep 21 '20 at 13:43
  • As I read it, the whole story is that there used to be one UNIX manual, organized in sections ("1", "2", ...), each one containing several pages, each page roughly relating to a specific piece of software or concept, each page made of some sections ("NAME", "SYNOPSIS", ...) (hence some confusion). On Unix-like systems the "UNIX" part is gone and we generally have the "manual", though the singular and plural forms of the word are somehow inconsistently used across the man(ual) pages themselves. I'm not editing your answer, though, since this would diverge significantly from what you wrote. – fra-san Sep 21 '20 at 17:05
  • @fra-san: That sounds logical... Anyway - if you feel it's worth an edit, please feel free. I couldn't see an easy way to explain that section duality... in fact, it's so messy I wish I didn't know of it! – Seamus Sep 21 '20 at 17:48
2

as per man man

man [[section] page]

section should prefix page you are looking for. e.g.

man 1 passwd
man 5 passwd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.