12、date
date -u
date +%y%m%d %h-%m%s 格式化 == date +%f
date +%s 時間戳
date -d @時間戳 「格式」 例:date -d @1510111518 「+%y-%m-%d %h-%m-%s」
clock 當前的硬體時間檢視
clock -s 把硬體的時間讀出來覆蓋到系統時間
clock -w 把系統時間讀出來覆蓋到硬體的時間
hwclock與clock一樣
13、時區:
ll /etc/localtime (不是乙個文字檔案)
顯示日曆:
cal -y
cal 2018
cal 08 2008
cal 09 1752
timedatectl list-timezones 檢視時區(centos 7)
timedatetcl set-timezones 設定時區
14、ps aux | grep sleep -> 檢視程序
15、pwd 顯示當前目錄
pwd -p 顯示真實物理路徑
pwd -l 顯示鏈結路徑(預設行為, 不需要加)
. 表示當前路徑
… 表示父目錄
cd - :返回上乙個剛剛離開的目錄(僅一次)
16、screen
screen -ls 顯示所有已經開啟的會話
screen -r 恢復screen會話
screen -x 會話名 加入會話
ctrl+a 再按d
17、echo 回顯
echo -n 不自動換行
echo -e 解析
\a 發出聲音
\b 退格鍵
\c 最後不加上換行符號
\n 換行且游標移至行首
\r 回車
\t 插入tab
\ 插入
\0nnn
\xhh
18、 nmcli 配置網路命令
19、 iconv -l 顯示編碼資訊
iconv -f gb2312 filename -o newfilename 轉義檔案
20、單引號、雙引號、反向單引號
單引號:直接輸出,什麼都不認
雙引號: 識別命令
反向單引號: 命令、變數都識別 ==$() >date +%f
.log 建立日期格式的log檔案
echo 輸出1-10 的數字
21、touch 建立空檔案
touch f1 f2 f3
touch f
cp f1 複製指定檔案,重新命名字尾;類似於備份
22、linux幫助
whatis
command --help
man and info
本地幫助文件 /usr/share/doc/
whatis 命令 /man -f 命令列
1.makewhatis (centos 6) 建立whatis資料庫
2. mandb (centos 7) 建立whatis資料庫
內部命令檢視
help 命令
man bash 命令 檢視bash幫助
檢視外部命令幫助
命令 --help
1.文字搜尋:
/單詞 向下搜尋
?單詞 逆向搜尋
n鍵:查詢其他詞
空格: 整屏翻頁
回車: 一行一行往下走
q 退出幫助
23、systemctl enable autofs 設定服務開機啟動
24、檔案時間
mtime : 檔案內容更改時間
ctime : 檔案本身的更改時間
atime :記錄讀取時間
ll --time=ctime filename
relatime
stat filename 顯示指定檔案的mtime、ctime、atime
25、basename : 檔案基名; 取檔名
例如: basename 路徑
dirname : 取路徑名; 不要檔名
26、ls
ls -r :遞迴顯示目錄(連子目錄都顯示)
ls -ld : 顯示目錄本身的屬性
ls -l : 豎著顯示(分行)顯示
ls -tl :(組合)按照時間排序
ls -d : 純目錄;不顯示檔案; ls -d */
ll f[135]
ll f[1-6]
ll [[:lower:]]
27、cat /etc/dir_colors 定義檔案顏色
運維linux命令
原文 感謝博主的文章!之前做過兩年的運維,用過很多命令,深切體會到某些linux命令熟練掌握後對效率提公升有多大。舉個簡單的例子,在做了研發後經常會有跑一些資料,對於結果資料的處理,我們的產品同學一般都習慣於用excel做統計,把資料複製到excel裡,然後資料分列,排序 最後得出某些簡單的結論,我...
運維linux命令
1 linux啟動過程 開啟電源 bios開機自檢 引導程式lilo或grub 核心的引導 kernel boot 執行init rc.sysinit rc mingetty 建立終端 shell 2 網絡卡繫結多ip ifconfig eth0 1 192.168.1.99 netmask 255...
linux運維命令
1 linux啟動過程 開啟電源 bios開機自檢 引導程式lilo或grub 核心的引導 kernel boot 執行init rc.sysinit rc mingetty 建立終端 shell top 然後按shift p,按照程序處理器佔用率排序 top 24 檢視記憶體使用情況的命令 用fr...