ดังนั้นสำหรับตัวอย่างเช่นเมื่อฉันพิมพ์ฉันเห็นman ls LS(1)แต่ถ้าฉันพิมพ์man apachectlฉันเห็นAPACHECTL(8)และถ้าฉันพิมพ์ฉันจบลงด้วยman cdcd(n)
ฉันสงสัยว่าความหมายของตัวเลขในวงเล็บคืออะไรถ้ามี
export MANSECT=0p:1:2:3:3p:4:5:6:7:8:9:l:s:n
ดังนั้นสำหรับตัวอย่างเช่นเมื่อฉันพิมพ์ฉันเห็นman ls LS(1)แต่ถ้าฉันพิมพ์man apachectlฉันเห็นAPACHECTL(8)และถ้าฉันพิมพ์ฉันจบลงด้วยman cdcd(n)
ฉันสงสัยว่าความหมายของตัวเลขในวงเล็บคืออะไรถ้ามี
export MANSECT=0p:1:2:3:3p:4:5:6:7:8:9:l:s:n
คำตอบ:
จำนวนสอดคล้องกับส่วนของคู่มือที่หน้านั้นมาจาก; 1 คือคำสั่งของผู้ใช้ในขณะที่ 8 คือสิ่งที่ดูแลระบบ หน้าคนสำหรับตัวเอง ( man man) อธิบายและแสดงรายการมาตรฐาน:
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.
มีคำบางคำที่มีหน้าต่างๆในส่วนต่าง ๆ (เช่นprintfคำสั่งปรากฏในส่วนที่ 1 เนื่องจากstdlibฟังก์ชั่นปรากฏในส่วนที่ 3) ในกรณีเช่นนี้คุณสามารถส่งหมายเลขส่วนไปmanยังหน้าชื่อเพื่อเลือกสิ่งที่คุณต้องการหรือใช้man -aเพื่อแสดงทุกหน้าที่ตรงกันในแถว:
$ man 1 printf
$ man 3 printf
$ man -a printf
คุณสามารถบอกได้ว่าส่วนใดของคำที่ตรงกับman -k(เทียบเท่ากับaproposคำสั่ง) มันจะทำการจับคู่ซับสตริงด้วย (เช่นจะแสดงsprintfถ้าคุณเรียกใช้man -k printf) ดังนั้นคุณต้องใช้^termเพื่อ จำกัด :
$ man -k '^printf'
printf (1) - format and print data
printf (1p) - write formatted output
printf (3) - formatted output conversion
printf (3p) - print formatted output
printf [builtins] (1) - bash built-in commands, see bash(1)
man X intro X
man man... จนกระทั่งตอนนี้
ประวัติของหมายเลขส่วนเหล่านี้กลับไปที่คู่มือUnix Programmerดั้งเดิมของ Thompson และ Ritchie ในปี 1971
ส่วนเดิมคือ
pipe(7), tcp(7)(และอื่น ๆ อีกหลายเครือข่ายหน้าคน) pthreads(7), boot(7), regex(7)ฯลฯ มีสิ่งอื่น ๆ ในมาตรา 7 เป็นอย่างดีเช่นascii(7)(ตาราง ASCII) และman(7)(วิธีการเขียนหน้าคน) แต่หน้าเอกสารกว้างไกลโดย สิ่งที่มีประโยชน์ที่สุดในส่วนที่ 7 ในประสบการณ์ของฉัน
konqueror ยังอธิบายถึงส่วนที่ไม่ได้มาตรฐาน: (ขอบคุณ @ greg0ire สำหรับแนวคิด)
0 Header files
0p Header files (POSIX)
1 Executable programs or shell commands
1p Executable programs or shell commands (POSIX)
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
3n Network Functions
3p Perl Modules
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)
9 Kernel routines
l Local documentation
n New manpages
สิ่งที่มันหมายถึงการอธิบายไว้แล้ว introแต่ผมยังต้องการที่จะเพิ่มว่าแต่ละส่วนมีหน้าคู่มือพิเศษด้วยการแนะนำ: ตัวอย่างเช่นดูman 1 introหรือman 3 introอื่น ๆ
man-pagesติดตั้งแพ็คเกจแล้วหรือยัง?
จากmanmanpage:
The table below shows the section numbers of the manual followed by the
types of pages they contain.
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 conven‐
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
ทำไมพวกมันถึงแยกกัน - มันมีบางอย่างทับซ้อนกัน บาง manpages มีอยู่มากกว่าหนึ่งส่วนขึ้นอยู่กับความหมายของคุณ
ตัวอย่างเช่นเปรียบเทียบman crontabกับman 5 crontab- โอกาสเป็นสิ่งหลังที่คุณต้องการค้นหา
man1pและman3p?
~/manที่ไหน?
นี่คือหมายเลขส่วน เพียงพิมพ์man manหรือเปิด konqueror และพิมพ์ man: // man แล้วคุณจะเห็นว่าส่วนเหล่านี้คืออะไร
บ่อยครั้งที่มีการอ้างอิง man page ผ่านทาง suffixing โดยมีส่วนที่อยู่ในวงเล็บเช่น:
read(2)
สไตล์นี้มีข้อดีสองประการ:
Man man จัดอยู่ในหมวดต่างๆเช่นส่วนที่ 1 รวม man man คำสั่งของผู้ใช้ทั้งหมดส่วนที่ 2 man man ทั้งหมดสำหรับการเรียกระบบส่วนที่ 3 ใช้สำหรับฟังก์ชั่นห้องสมุดเป็นต้น
ในบรรทัดคำสั่งหากคุณไม่ได้ระบุส่วนที่ชัดเจนคุณจะได้รับหน้าแรกที่ตรงกันในลำดับการสำรวจเส้นทางส่วนเริ่มต้นเช่น:
$ man read
แสดงBASH_BUILTINS(1)บน Fedora ที่ไหน
$ man 2 read
แสดง man page สำหรับการread()เรียกของระบบ
โปรดทราบว่าข้อกำหนดตำแหน่งของส่วนนี้ไม่สามารถเคลื่อนย้ายได้ - เช่นบน Solaris คุณต้องระบุดังนี้:
$ man -s 2 read
โดยปกติแล้วจะman manแสดงบางส่วนที่มีอยู่ด้วย แต่ไม่จำเป็นเสมอไป $MANPATHสำหรับรายชื่อที่มีอยู่ทั้งหมดส่วนหนึ่งอาจแสดงรายการไดเรกทอรีย่อยของไดเรกทอรีทั้งหมดที่ระบุไว้ในเส้นทางของคนที่เริ่มต้นหรือตัวแปรสภาพแวดล้อม ตัวอย่างเช่นในระบบ Fedora 23 ที่ติดตั้งแพคเกจการพัฒนาบางตัว/usr/share/manมีไดเรกทอรีย่อยดังต่อไปนี้:
cs es id man0p man2 man3x man5x man7x man9x pt_BR sk zh_CN
da fr it man1 man2x man4 man6 man8 mann pt_PT sv zh_TW
de hr ja man1p man3 man4x man6x man8x pl ro tr
en hu ko man1x man3p man5 man7 man9 pt ru zh
ไดเรกทอรีที่มีmanคำนำหน้าแทนแต่ละส่วน - ในขณะที่อีกไดเรกทอรีหนึ่งมีส่วนที่แปลแล้ว ดังนั้นในการรับรายการส่วนที่ไม่ว่างเปล่าเราสามารถออกคำสั่งดังนี้:
$ find /usr/share/man -type f | sed 's@^.*/man\(..*\)/.*$@\1@' \
| sort -u | column
0p 1p 3 4 6 8
1 2 3p 5 7
(ส่วนที่ลงท้ายด้วยpหน้าคน POSIX)
หากต้องการดู man page ในภาษาอื่น (ถ้ามี) สามารถตั้งค่าตัวแปรสภาพแวดล้อมที่เกี่ยวข้องกับภาษาเช่น:
$ LC_MESSAGES=de_DE man read
นอกจากนี้แต่ละส่วนควรมีหน้าคู่มือแนะนำชื่อintroเช่นสามารถดูได้ผ่าน:
$ man 2 intro
คำจำกัดความสำหรับ SVr4 คือ:
1 User Commands
2 System Calls
3 library Functions
4 File Formats
5 Standards, Environment and Macros (e.g. man(5))
6 Games and Demos
7 Device and Network Interfaces, Special Files
8 Maintenance Procedures
9 Kernel and Driver entry points and structures
นี่เป็นตัวเลขจริงสำหรับ UNIX "ทางพันธุกรรม" POSIX ไม่ได้กำหนดหมายเลข