[CentOS 7系列]作業控制
1、jobs
[[email protected] ~]# top top - 06:39:07 up 8:24, 3 users, load average: 0.01, 0.04, 0.05 Tasks: 87 total, 1 running, 84 sleeping, 2 stopped, 0 zombie %Cpu(s): 0.5 us, 0.4 sy, 0.0 ni, 99.0 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1008392 total, 157936 free, 132356 used, 718100 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 660208 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 30125 root 20 0 157572 2076 1504 R 6.2 0.2 0:00.01 top 1 root 20 0 45528 5812 3672 S 0.0 0.6 0:02.34 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:04.36 ksoftirqd/0 4 root 20 0 0 0 0 D 0.0 0.0 0:38.92 kworker/0:0 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 0:01.27 rcu_sched 10 root rt 0 0 0 0 S 0.0 0.0 0:02.68 watchdog/0 12 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 14 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns 15 root 20 0 0 0 0 S 0.0 0.0 0:00.01 khungtaskd 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback 17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd 18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd [1]+ 已停止 top ## ctrl+z 暫停一個任務 [[email protected]
2、fg
[[email protected] ~]# jobs [1]- 已停止 top [2]+ 已停止 man fdisk [[email protected] ~]# fg 1 ##將任務調度到前臺運行 top - 06:58:25 up 8:43, 3 users, load average: 0.00, 0.01, 0.05 Tasks: 102 total, 3 running, 82 sleeping, 17 stopped, 0 zombie %Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1008392 total, 153464 free, 136164 used, 718764 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 656136 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4 root 20 0 0 0 0 R 0.2 0.0 0:40.85 kworker/0:0 30083 root 20 0 143020 5556 4252 S 0.1 0.6 0:00.93 sshd 9 root 20 0 0 0 0 S 0.0 0.0 0:01.34 rcu_sched 287 root 20 0 0 0 0 S 0.0 0.0 0:08.18 xfsaild/sda3 502 root 20 0 327432 26912 6556 S 0.0 2.7 0:04.39 firewalld 30087 root 20 0 115508 2168 1764 R 0.0 0.2 0:00.21 bash 1 root 20 0 45528 5812 3672 S 0.0 0.6 0:02.35 systemd 10 root rt 0 0 0 0 S 0.0 0.0 0:02.71 watchdog/0 801 root 20 0 553152 18520 5816 S 0.0 1.8 0:07.17 tuned 20876 root 20 0 0 0 0 S 0.0 0.0 0:00.41 kworker/u12+ 2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:04.39 ksoftirqd/0 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 12 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 14 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns ## ctrl+c 結束一個任務 [[email protected]