[root@localhost ~]# ls 111 123 1.txt 234 2.txt 2.txt.bak 3.txt anaconda-ks.cfg [root@localhost ~]# ls | wc -l 8
[root@localhost ~]# find ./ -type f ./.bash_logout ./.bash_profile ./.bashrc ./.cshrc ./.tcshrc ./anaconda-ks.cfg ./.bash_history ./.viminfo ./1.txt ./2.txt ./3.txt ./2.txt.bak [root@localhost ~]# find ./ -type f |wc -l 計算當前目錄下,有多少個文件 12
[root@localhost ~]# vim 1.txt [1]+ 已中止 vim 1.txt [root@localhost ~]# fg vim 1.txt [1]+ 已中止 vim 1.txt [root@localhost ~]# jobs [1]+ 已中止 vim 1.txt [root@localhost ~]# vim 2.txt [2]+ 已中止 vim 2.txt [root@localhost ~]# jobs [1]- 已中止 vim 1.txt [2]+ 已中止 vim 2.txt [root@localhost ~]#
[root@localhost ~]# fg 1
[root@localhost ~]# bg 1 [1]+ vim 1.txt &
運行一條命令,能夠將它丟到後臺(前臺)去運行 在結束任務的時候,必須是在前臺才能結束——>(不然在後臺是沒法結束任務的)vim
[root@localhost ~]# sleep 1000 ^Z [1]+ 已中止 sleep 1000 [root@localhost ~]# jobs [1]+ 已中止 sleep 1000 [root@localhost ~]# sleep 200 ^Z [2]+ 已中止 sleep 200 [root@localhost ~]# jobs [1]- 已中止 sleep 1000 [2]+ 已中止 sleep 200 [root@localhost ~]# fg sleep 200 ^Z [2]+ 已中止 sleep 200
在調到先後臺運行的時候,不指定id號,就是默認最後一條執行命令
[root@localhost ~]# sleep 100 & [3] 2239 [root@localhost ~]# jobs [1] 運行中 sleep 100 & [root@localhost ~]#
在打開另外一終端,jobs命令,是查看不到執行當前終端的任務bash
可是在另外一個終端,能夠查看到進程ps aux |grep sleep命令行
``` [root@localhost ~]# ps aux |grep sleep root 2235 0.0 0.0 107892 624 pts/0 T 23:20 0:00 sleep 1000 root 2236 0.0 0.0 107892 620 pts/0 T 23:20 0:00 sleep 200 root 2264 0.0 0.0 112656 984 pts/1 R+ 23:31 0:00 grep --color=auto slee [root@localhost ~]# ```