歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> man幫助的使用

man幫助的使用

日期:2017/3/3 10:58:30   编辑:Linux技術

內部命令本身就可以隨著bash程序的一執行,就加載到內存中

例題:

生成一個以當前日期開頭的日志文件:

touch `date +%F`.log //命令調用另一個命令,就考慮使用反向單引號或者$()

刪除一個文件夾中的所有內容:

1.進入文件夾中:

rm -rf *

2.當沒有進入文件夾中時:

rm -rf 目標文件名/*

連續建立三個文件:touch file1 file2 file3

touch file{1,2,3}

whatis

顯示命令的簡短介紹

每晚使用一個數據庫更新

剛安裝後不可立即使用

centos6 用makewhatis來制作數據庫

chentos7用mandb來制作數據庫

man -f 與 whatis 類似,都能查看一個命令的簡要

what is rm 或 man -f rm

在man手冊頁中 [-u|--utc|--universdal]來表示三個選項其中一個“為三選一”

顯示昨天日期:date -d yesterday +%F

顯示幾天前日期,例如3天前的日期

date -d '3 days ago' +%F

man幫助頁被放在了, /usr/share/man 目錄下

在man幫助文件夾中都是.gz的壓縮文件

命令passwd所在的路徑為:/usr/bin/passwd 這個與/etc/passwd 不是同一個文件

bin下為二進制文件。 etc下文件都為文本文件

man中共分9個章節,在linux中最常用的章節為三個, 1.用戶命令 5.配置文件格式 8.管理命令

在使用man手冊頁時,我們應該首先查看一下,該命令在那些章節

whatis 命令字――> man 所在的章節號 命令字

在每次安裝一個命令時,都會將自己的幫助文檔放在 /usr/share/man對應的章節中

man 的配置文件: /etc/man.config

查看所有的man手冊頁

man -a 命令字

練習:

字符終端登錄時,顯示當前的登錄終端號,主機名,和當前時間

分析:

字符終端登錄時,前面顯示的提示信息,就是由 /etc/issue文檔提供的所以應該編輯這個文檔,那怎麼用man手冊頁呢?

步驟:

1.man issue

2.當沒有有用的選項或者解釋時,我們再查看 SEE ALSO中的內容

SEE ALSO

motd(5), agetty(8), mingetty(8)

3.[root@localhost man]# man 8 mingetty

4. \d insert current day (localtime),

\l insert line on which mingetty is running,

\m inserts machine architecture (uname -m),

\n inserts machine’s network node hostname (uname -n),

\o inserts domain name,

\r inserts operating system release (uname -r),

\t insert current time (localtime),

\s inserts operating system name,

\u resp. \U the current number of users which are cur-

rently logged in. \U inserts "n users", where as

\u only inserts "n".

\v inserts operating system version (uname -v).

所以我們就可以做出這道題來了:如下

vi /etc/issue 或 nano /etc/issue

加上的內容為:

port:\n

host:\d

time:\t

在linux安裝程序的時候,有可能在/usr/share/doc目錄下生成相應的幫助文檔

在登錄shell時會自動先讀取 ~/.bash_history 文件中的歷史命令

Copyright © Linux教程網 All Rights Reserved