-- 註釋: 列出mnt目錄下的文件及其子目錄-- > ls /mnt apk-update-service git-repo-for-redmine license_capture lost+found mysql newprojects test -- 註釋: 列出/mnt目錄下文件及其子目錄的詳細信息-- > ls -l /mnt total 40 drwxrwxrwx 2 root root 4096 Jul 22 09:56 apk-update-service drwxr-xr-x 5 root root 4096 Jun 27 2017 git-repo-for-redmine drwxr-xr-x 3 root root 4096 Jul 31 2017 license_capture drwx------ 2 root root 16384 Jun 6 2017 lost+found drwxr-xr-x 3 root root 4096 Jun 10 2017 mysql drwxr-xr-x 6 root root 4096 Oct 10 2017 newprojects drwxr-xr-x 10 root root 4096 Nov 6 2017 test -- 註釋: 顯示mnt目錄下的全部文件及其目錄的詳細信息, 並顯示文件類型標記-- > ls -alF /mnt ls -alF /mnt total 48 drwxr-xr-x 9 root root 4096 Jul 31 2017 ./ dr-xr-xr-x. 25 root root 4096 Jun 8 15:30 ../ drwxrwxrwx 2 root root 4096 Jul 22 09:56 apk-update-service/ drwxr-xr-x 5 root root 4096 Jun 27 2017 git-repo-for-redmine/ drwxr-xr-x 3 root root 4096 Jul 31 2017 license_capture/ drwx------ 2 root root 16384 Jun 6 2017 lost+found/ drwxr-xr-x 3 root root 4096 Jun 10 2017 mysql/ drwxr-xr-x 6 root root 4096 Oct 10 2017 newprojects/ drwxr-xr-x 10 root root 4096 Nov 6 2017 test/
> pwd /root
> cd /mnt > pwd /mnt
語法: cd 返回根目錄中
語法: **cd - **返回上次調整的目錄中vue
> pwd -- 當前目錄 /mnt > cd -- 跳到根目錄 /root > cd - -- 跳到最近一次跳轉的目錄中 /mnt
> date '+%y-%m-%d' 18-10-08
語法: date ‘%x’ 或 '%X’ 顯示日期/時間java
> date '+today is %x %X' today is 10/08/2018 02:21:41 PM
語法: ***date -s yyyyMMdd HH:mm:ss***或 date -s yyyyMMdd 或 date -s HH:mm:ss 設置系統時間mysql
> date -s "20180715 17:25" Tue Jul 15 17:25:00 CST 2018
語法: ***date -d 「num years/months/days ago」 %y-%m-%d***當前時間的前年/月/日的時間linux
> date +%y-%m-%d 18-10-08 > date -d "10 days ago" +%y-%m-%d 18-09-28
> clear
> man clear clear(1) clear(1) NAME clear - clear the terminal screen SYNOPSIS clear DESCRIPTION clear clears your screen if this is possible. It looks in the environment for the terminal type and then in the terminfo database to figure out how to clear the screen. clear ignores any command-line parameters that may be present. SEE ALSO tput(1), terminfo(5) This describes ncurses version 5.7 (patch 20090207). clear(1) (END)
> who root pts/0 2018-10-08 13:26 (203.110.178.83) -- 註釋: 輸出格式爲 名稱 [狀態] 終端 時間 [活動] [進程標識](主機名) * 名稱:用戶的登陸名。 * 狀態:代表終端是否對用戶都是可寫的。 * 終端:相似於pts/一、pts/2等,此終端標識在/dev目錄中可找到。 * 時間:用戶登陸系統的時間。 * 活動:某個用戶在本身的終端上最後一次活動發生以來到如今的時間,若是此項是個「.」,就表示一分鐘內的終端活動;若是終端保持靜止已經超過24小時或自從系統啓動以來尚未被使用過,那麼此項標記爲「old」。 * 進程標識:用戶登陸shell的進程id。 * 主機名:登陸到Linux系統上的客戶端機器標識。 -- -- 註釋: 查看運行級別-- > who -r run-level 3 2017-07-15 15:26 > who -w root + pts/0 2018-10-08 13:26 (203.110.178.83) > who -buT system boot 2017-07-15 15:26 root + pts/0 2018-10-08 13:26 . 2887 (203.110.178.83)
> free total used free shared buffers cached Mem: 8061108 7875964 185144 146236 201324 558792 -/+ buffers/cache: 7115848 945260 Swap: 0 0 0
> ps PID TTY TIME CMD 2887 pts/0 00:00:00 zsh 24884 pts/0 00:00:00 ps -- 註釋: (輸出說明) pid: 進程的標識符 tty: 進程所屬的終端控制檯 time: 進程所使用的總的cpu時間 cmd: 列出正在執行的命令行 -- > ps -aux > ps -ef
> top top - 15:31:25 up 450 days, 4 min, 1 user, load average: 0.00, 0.00, 0.00 Tasks: 403 total, 1 running, 402 sleeping, 0 stopped, 0 zombie Cpu(s): 0.9%us, 0.4%sy, 0.0%ni, 98.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8061108k total, 7873600k used, 187508k free, 201444k buffers Swap: 0k total, 0k used, 0k free, 538576k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3687 git 20 0 1460m 760m 11m S 1.0 9.7 509:44.69 bundle 15635 gitlab-r 20 0 241m 12m 912 S 1.0 0.2 366:27.19 redis-server -- 註釋: > 第一行: 15:31:25 當前系統的時間; up 450 days 表示系統已啓動450天4分鐘; 1 user當前在線的用戶數爲1人; load average:0.00,0.00,0.00表示系統平均負載,3個數分別爲1分鐘/5分鐘/15分鐘前到如今的系統平均負載. > 第2、三行 Tasks:403 total總共有403個進程; 1 running: 1個運行 402 sleeping:402個處於休眠狀態 0 stopped:0箇中止 0 zombie:0個僵死 Cpu(s):0.9% us:表示用戶進程佔用CPU的百分比。 0.1% sy:系統進程佔用CPU的百分比。 0.0% ni:用戶進程空間內改變過優先級的進程佔用CPU的百分比。 99.3% id:空閒CPU佔用的百分比。 0.2% wa:等待輸入、輸出的進程佔用CPU的百分比。 > 最後兩行 Mem:4059952k total:系統的物理內存大小。 4009540k used:已經使用的物理內存大小。 50412k free:目前空餘內存大小。 468964k buffers:用做內核緩沖區的內存大小。 Swap:8193108k total:交換分區內存大小。 0k used:已經使用的交換分區大小。 8193108k free:空閑的交換分區大小。 2320396k cached:緩存大小。 > 進程信息區 進程信息區 進程信息區顯示了每個進程的運行狀態,我們先來看一下每列輸出的含義。 PID:進程的id。 USER:進程全部者的用戶名。 pr:進程優先級。 NI:nice值。負值表示高優先級,正值表示低優先級。 VIRT:進程使用的虛擬內存總量,單位KB。VIRT=SWAP+RES。 RES:進程使用的、未被換出的物理內存大小,單位KB。RES=CODE+DATA,其中,CODE爲執行代碼佔用的物理內存大小,DATA爲數據佔用的內存大小。 SHR:共享內存大小,單位KB。 S:進程狀態,D表示不可中斷的睡眠狀態,R表示運行狀態,S表示睡眠狀態,T表示跟蹤/中止,Z表示僵死進程。 %CPU:上次更新到如今的CPU時間佔用百分比。 %MEM:進程佔用的物理內存百分比。 TIME+:進程總計使用的CPU時間,單位爲1/100秒。 COMMAND:正在運行進程的命令名或者命令路經。 --
-- 註釋: 查找大於100M的文件, 可是這樣沒法看文件的大小/屬性等 -- > find . -type f -size +100M ./Downloads/root@cq.hbjk.com.cn ./Downloads/jdk-8u131-linux-x64.rpm -- 註釋: 查找大於100M的文件, 能夠看到文件的大小/屬性 -- > find . -type f -size +100M -print0 | xargs -0 ls -l -rw-r--r-- 1 root root 169983496 Mar 16 2017 ./Downloads/jdk-8u131-linux-x64.rpm -rw-r--r-- 1 root root 169983496 Oct 18 2017 ./Downloads/root@cq.hbjk.com.cn -- 註釋: 查找大於100M的文件, 只看大小 -- > find . -type f -size +100M -print0 | xargs -0 du -h 163M ./Downloads/root@cq.hbjk.com.cn 163M ./Downloads/jdk-8u131-linux-x64.rpm -- 註釋: 查找大於100M的文件, 只看大小, 並排序 -- > find . -type f -size +100M -print0 | xargs -0 du -h | sort -nr 163M ./Downloads/root@cq.hbjk.com.cn 163M ./Downloads/jdk-8u131-linux-x64.rpm
-- 註釋: 查詢depth爲1的全部文件, 並顯示文件大小-- > du -h --max-depth=1 69M ./.m2 60K ./.cache 1.4G ./Downloads 12K ./.oracle_jre_usage 8.0K ./.pki 170M ./.nvm 208M ./.npm 3.6M ./.gem 8.0K ./.pip 112K ./tmp 28M ./.bundle 56K ./.java 276K ./.ssh 4.9M ./.oh-my-zsh 296K ./.vue-templates 1.9G . -- 註釋: 查詢depth爲1的全部文件, 並將文件大小單位用M, 並排序 -- > du -hm --max-depth=1 | sort -n 1 ./.cache 1 ./.java 1 ./.oracle_jre_usage 1 ./.pip 1 ./.pki 1 ./.ssh 1 ./tmp 1 ./.vue-templates 4 ./.gem 5 ./.oh-my-zsh 28 ./.bundle 69 ./.m2 170 ./.nvm 208 ./.npm 1400 ./Downloads 1883 . -- 註釋: 查詢depth爲1的全部文件, 並將文件大小單位用M, 排序, 取前12個-- >du -hm --max-depth=2 | sort -nr | head -12 1883 . 1400 ./Downloads 383 ./Downloads/ruby-2.3.3 377 ./Downloads/ruby-2.4.1 208 ./.npm 170 ./.nvm 167 ./.nvm/versions 73 ./Downloads/redis-4.0.1 69 ./.m2/repository 69 ./.m2 47 ./Downloads/zookeeper-3.4.9 45 ./Downloads/kafka_2.11-0.11.0.0