What is the difference between "man chmod" and "man 2 chmod" ?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What is the difference between "man chmod" and "man 2 chmod" ?
Does "man 2 chmod" provide details on issuing a chmod function call and the "man chmod" describes details on the command line version of issuing a chmod command ?
Does "man 2 chmod" provide details on issuing a chmod function call and the "man chmod" describes details on the command line version of issuing a chmod command ?
Thanks
Probably.
It should clarify under NAME or DESCRIPTION in the man pages, but I don't have man 2 chmod on my systems, so I can't confirm.
Does "man 2 chmod" provide details on issuing a chmod function call and the "man chmod" describes details on the command line version of issuing a chmod command ?
The "2" section describes system calls that can be used by (mostly C) programs.
From "man 2 intro"
Quote:
Section 2 of the manual describes the Linux system calls. A system call is an entry point into the Linux kernel.
This call is used by the chmod command (which is in section 1), so its man page is more completely invoked as "man 1 chmod".
There are quite a few more cases where a command (in section 1) uses the same named system call (2) or library function (which is section 3).
So sections 2 and 3 are for programmers or people who want to know what the underlying calls do.
PS: each section of the man info pages has an introduction, that can be viewed with "man N intro" (with N being a number from 1 to 8).
By default, man uses the first match it finds, so a user command in Section 1 will always trump a system call of the same name in Section 2. Which is mostly what you want. If you do want to look up the system call, you can always specify section 2.
It becomes more problematic with the administrative commands in Section 8, because here a system call with the same name in Section 2 will be displayed preferentially. I've been caught that way a few times and it's very annoying.
It becomes more problematic with the administrative commands in Section 8,
That is one of the reasons why a "real System V Unix" uses section 1M (for management) for those commands, instead of 8
Code:
The manual is generally split into eight numbered sections, organized as follows (on Research Unix, BSD, macOS and Linux):
Section Description
1 General commands
2 System calls
3 Library functions, covering in particular the C standard library
4 Special files (usually devices, those found in /dev) and drivers
5 File formats and conventions
6 Games and screensavers
7 Miscellanea
8 System administration commands and daemons
Unix System V uses a similar numbering scheme, except in a different order:
Section Description
1 General commands
1M System administration commands and daemons
2 System calls
3 C library functions
4 File formats and conventions
5 Miscellanea
6 Games and screensavers
7 Special files (usually devices, those found in /dev) and drivers
The number corresponds to what section of the manual that page is from; 1 is user commands, while 8 is sysadmin stuff. The man page for man itself (man man) explains it and lists the standard ones:
MANUAL SECTIONS
The standard sections of the manual include:
1 User Commands
2 System Calls
3 C Library Functions
4 Devices and Special Files
5 File Formats and Conventions
6 Games et. al.
7 Miscellanea
8 System Administration tools and Daemons
Distributions customize the manual section to their specifics,
which often include additional sections.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.