date、man、hwclock、echo、printf
date:
ntp:network time protocol 網絡時間協議
硬件時鐘
系統時鐘
獲得命令使用幫助
help 查看一個內部命令使用幫助,查看一個內部命令幫助一般使用該命令
help COMMOND
2.man 查看外部命令使用幫助
man COMMOND 查看使用手冊
COMMOND --help
man是分章節的,常見章節有8個:
[[email protected] ~]# man ls
LS(1) User Commands LS(1)
(1)用戶命令(/bin、/usr/bin、/usr/local/bin等路徑下的命令)
(2)系統調用
(3)庫用戶
(4)特殊文件(設備文件)
(5)文件格式(解釋某一個命令配置文件的語法 【例:passwd中以:隔開的每一段字符含義】)
(6)遊戲說明
(7)不便歸類的雜項
(8)管理命令(管理員才有權限使用/sbin/、/usr/sbin、/usr/local/sbin等路徑下的命令)
whatis COMMOND:查看一個命令會出現在哪些章節中
[[email protected] ~]# man date
SYNOPSIS<>命令用法說明
date [OPTION]... [+FORMAT]
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
[]:可省略
|:多選一
<>:必選
{}:分組
……:可多次出現
DESCRIPTION<>命令用法詳盡說明,可能包括每一個命令選項的意義
DESCRIPTION<>命令用法詳盡說明,可能包括每一個命令選項的意義
OPTIONS<>有的命令會把每一個選項的意義寫在此處
FILES<>此命令相關的配置文件
BUGS<>bug的反饋
EXAMPLES<>使用示例
SEE ALSO<>另外參照
翻屏:
向後翻一屏:SPACE
向前翻一屏:b
向後翻一行:enter
向前翻譯行:k
查找:
/string:向後查找
n:下一個
N:前一個
?string:向前查找
n:前一個
N:後一個
FORMAT controls the output. Interpreted sequences are:
%% a literal %
%a locale‘s abbreviated weekday name (e.g., Sun)<>星期幾縮寫
[[email protected] ~]# date +%a
Tue
%A locale‘s full weekday name (e.g., Sunday)<>星期幾完整的
[[email protected] ~]# date +%a
Tuesday
%b locale‘s abbreviated month name (e.g., Jan)
[[email protected] ~]# date +%b
Jun
%B locale‘s full month name (e.g., January)
[[email protected] ~]# date +%a
June
%d day of month (e.g, 01)
%D date; same as %m/%d/%y
%e day of month, space padded; same as %_d
%F full date; same as %Y-%m-%d
%g last two digits of year of ISO week number (see %G)
%G year of ISO week number (see %V); normally useful only with %V
%h same as %b
%H hour (00..23)
%I hour (01..12)
%j day of year (001..366)
%k hour ( 0..23)
%l hour ( 1..12)
%m month (01..12)
%M minute (00..59)
%n a newline<>新的一行
%N nanoseconds (000000000..999999999)
%p locale‘s equivalent of either AM or PM; blank if not known
%P like %p, but lower case
%r locale‘s 12-hour clock time (e.g., 11:11:04 PM)
%R 24-hour hour and minute; same as %H:%M
%s seconds since 1970-01-01 00:00:00 UTC<>1970年1月1號到現在經過時間,除以86400
%S second (00..60)
%t a tab
%T time; same as %H:%M:%S
%u day of week (1..7); 1 is Monday
%U week number of year, with Sunday as first day of week (00..53)
%V ISO week number, with Monday as first day of week (01..53)
%w day of week (0..6); 0 is Sunday
%W week number of year, with Monday as first day of week (00..53)
%x locale‘s date representation (e.g., 12/31/99)
%X locale‘s time representation (e.g., 23:13:48)
%y last two digits of year (00..99)
%Y year
hwclock
-s 硬件時鐘到系統,同步以後系統時間為硬件時間
-w 系統時鐘到迎檢,同步以後硬件時間為系統時間
cal 日歷
echo
Options:
-n do not append a newline<>不換行輸出,默認換行輸出
-e enable interpretation of the following backslash escapes<>逃逸字符
-E explicitly suppress interpretation of backslash escapes
\b backspace<>退格
[[email protected] ~]# echo "You is a shadiao.\bnonono"
You is a shadiao.\bnonono
[[email protected] ~]# echo -e "You is a shadiao.\bnonono"
You is a shadiaononono
\v vertical tab<>縱向制表符
[[email protected] ~]# echo "You is a shadiao.nonono"
You is a shadiao.nonono
[[email protected] ~]# echo -e "You is a shadiao.\vnonono"
You is a shadiao.
nonono
\n new line<>換行
[[email protected] ~]# echo "You is a shadiao.nonono"
You is a shadiao.nonono
[[email protected] ~]# echo -e "You is a shadiao.\nnonono"
You is a shadiao.
nonono
\t horizontal tab<>橫向制表符
[[email protected] ~]# echo "You is a shadiao.nonono"
You is a shadiao.nonono
[[email protected] ~]# echo -e "You is a shadiao.\tnonono"
You is a shadiao. nonono
printf 格式化輸出
本文出自 “liuqistyle” 博客,請務必保留此出處http://liuqistyle.blog.51cto.com/10991928/1939365
date、man、hwclock、echo、printf