LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 06-16-2020, 01:32 PM   #1
Victor43
Member
 
Registered: May 2020
Posts: 46

Rep: Reputation: Disabled
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 ?

Thanks
 
Old 06-16-2020, 01:40 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,927

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
see man man
2 is a section.
 
1 members found this post helpful.
Old 06-16-2020, 01:42 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,733

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by Victor43 View Post
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.
 
Old 06-16-2020, 01:57 PM   #4
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by Victor43 View Post
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).
 
2 members found this post helpful.
Old 06-16-2020, 02:18 PM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,611
Blog Entries: 19

Rep: Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458Reputation: 4458
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.
 
1 members found this post helpful.
Old 06-16-2020, 03:32 PM   #6
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by hazel View Post
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
(cut from en.wikipedia.org/wiki/Man_page#Manual_sections)

Last edited by ehartman; 06-16-2020 at 04:43 PM.
 
Old 06-16-2020, 04:23 PM   #7
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Incidentally,
Code:
whatis chmod
outputs something not very similar to the headings of man chmod & man 2 chmod
Quote:
chmod (1) - change file mode bits
chmod (2) - change permissions of a file
 
1 members found this post helpful.
Old 06-17-2020, 02:51 AM   #8
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by JeremyBoden View Post
Incidentally,
Code:
whatis chmod
outputs something not very similar to the headings of man chmod & man 2 chmod
The lines from "whatis" DO come from their respective man pages:
the "NAME" section:
Code:
 $ man chmod
NAME
       chmod - change file mode bits
vs
 $ man 2 chmod
NAME
       chmod, fchmod, fchmodat - change permissions of a file
(the latter - of course - will be 3 different entries in the whatis database).
 
2 members found this post helpful.
Old 06-17-2020, 03:59 AM   #9
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,159

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Wink

Quote:
Originally Posted by pan64 View Post
see man man
2 is a section.
Or the OP should tried man to man

@OP see this link: https://unix.stackexchange.com/quest...-man-page-mean

From link above:

Quote:
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the difference between chmod and setfacl prakashkumar84 Linux - General 13 09-29-2017 03:22 PM
[SOLVED] What's the difference between chmod 0755 file and chmod 755 file? cola Linux - Newbie 6 04-19-2010 04:29 PM
Apache: difference between chmod 644 and chmod 666 and chmod 600 for output/txt/dat? frenchn00b Programming 6 04-22-2009 01:10 PM
difference between "man" and "info" gexecuter Linux - Newbie 17 09-26-2007 03:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration