歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> N天學習一個Linux命令之幫助命令:man,linuxman

N天學習一個Linux命令之幫助命令:man,linuxman

日期:2017/3/3 18:10:17   编辑:學習Linux

N天學習一個Linux命令之幫助命令:man,linuxman

N天學習一個Linux命令之幫助命令:man,linuxman


前言

工作中每天都在使用常用的命令和非常用的命令,忘記了用法或者參數,都會bing一下,然後如此循環。一直沒有真正的系統的深入的去了解命令的用法,我決定打破它。以前看到有人,每天學習一個linux命令,我現在沒有這麼充足時間,我恐怕一周學習一個linux命令我都做不到,想想我還是N天學習一個linux命令吧,從現在開始算起。

用途

顯示命令幫助文檔以及用法

用法

man [options] [section] cmd

命令文檔部分說明

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 conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
A manual page consists of several sections.

常用參數用法

顯示命令版本

[root@localhost ~]# man -V
man 2.6.3

查看命令幫助信息

[root@localhost ~]# man -h
Usage: man [OPTION...] [SECTION] PAGE...

顯示指定命令的配置文件

默認配置所使用的配置文件/etc/man_db.conf
[root@localhost ~]# man -C /etc/man.conf man

顯示調試信息

[root@localhost ~]# man -d man
From the config file /etc/man_db.conf:
Mandatory mandir `/usr/man'.
Mandatory mandir `/usr/share/man'.
Mandatory mandir `/usr/local/share/man'.
Path `/bin' mapped to mandir `/usr/share/man'.
Path `/usr/bin' mapped to mandir `/usr/share/man'.
Path `/sbin' mapped to mandir `/usr/share/man'.
Path `/usr/sbin' mapped to mandir `/usr/share/man'.
Path `/usr/local/bin' mapped to mandir `/usr/local/man'.
Path `/usr/local/bin' mapped to mandir `/usr/local/share/man'.
Path `/usr/local/sbin' mapped to mandir `/usr/local/man'.

輸出命令原始文檔所在路徑

[root@localhost ~]# man -w man
/usr/share/man/man1/man.1.gz

輸出命令轉義文檔所在路徑

[root@localhost ~]# man -W man

顯示指定輸出文檔內容使用的命令

默認使用的命令是less
[root@localhost ~]# man -P cat man
MAN(1) Manual pager utils MAN(1)
NAME
man - an interface to the on-line reference manuals

輸出格式化文檔之後的文本格式內容

[root@localhost ~]# man man | col -b > man.log

後記

1 大部分命令都會有幫助文檔,man命令可以跟這些幫助文檔交互。
2 後端開發多多少少都需要維護類unix服務器,平時多深入了解命令的用法會對平時的工作很有幫助。

參考資料

【1】man -h 以及 man man

http://xxxxxx/Linuxjc/1165303.html TechArticle

Copyright © Linux教程網 All Rights Reserved