[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 ~]# ```