一、經過ps命令的兩種選項形式查看進程信息
[root@localhost ~]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.4 128164 4304 ? Ss 08:14 0:02 /usr/lib/systemd/systemd --switched-root --system
root 2 0.0 0.0 0 0 ? S 08:14 0:00 [kthreadd]
[root@localhost ~]# ps -elf
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
4 S root 1 0 0 80 0 - 32041 ep_pol 08:14 ? 00:00:02 /usr/lib/systemd/systemd --switched-roo
1 S root 2 0 0 80 0 - 0 kthrea 08:14 ? 00:00:00 [kthreadd]
二、經過top命令查看進程
[root@localhost ~]# top -b -n1
top - 16:05:21 up 7:50, 3 users, load average: 0.00, 0.01, 0.05
Tasks: 178 total, 1 running, 176 sleeping, 1 stopped, 0 zombie
%Cpu(s): 0.0 us, 16.7 sy, 0.0 ni, 83.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 999696 total, 86788 free, 552848 used, 360060 buff/cache
KiB Swap: 2097148 total, 1906316 free, 190832 used. 229008 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
48688 root 20 0 157732 2060 1480 R 5.9 0.2 0:00.03 top
1 root 20 0 128164 4304 2368 S 0.0 0.4 0:02.83 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
三、經過pgrep命令查看sshd服務的進程號
[root@localhost ~]# pgrep -a "sshd"
1128 /usr/sbin/sshd -D
46164 sshd: root@pts/1
四、查看系統進程樹
[root@localhost ~]# pstree -aup
systemd,1 --switched-root --system--deser
├─ModemManager,751
│ ├─{ModemManager},774
│ └─{ModemManager},780
├─NetworkManager,804 --no-daemon
│ ├─dhclient,44921 -d -q -sf ...
│ ├─{NetworkManager},812
│ └─{NetworkManager},814
五、使dd if=/dev/zero of=/root/file bs=1M count=8190 命令操做在前臺運行
root@localhost ~]# dd if=/dev/zero of=/root/file bs=1M count=8190
^Z
[5]+ 已中止 dd if=/dev/zero of=/root/file bs=1M count=8190
[root@localhost ~]# fg 5 dd if=/dev/zero of=/root/file bs=1M count=8190 記錄了8190+0 的讀入 記錄了8190+0 的寫出 8587837440字節(8.6 GB)已複製,34.8704 秒,246 MB/秒 六、將第5題命令操做調入到後臺並暫停 root@localhost ~]# dd if=/dev/zero of=/root/file bs=1M count=8190 ^Z [5]+ 已中止 dd if=/dev/zero of=/root/file bs=1M count=8190 七、使dd if=/dev/zero of=/root/file2 bs=1M count=1024 命令操做在後臺運行 [root@localhost ~]# dd if=/dev/zero of=/root/file2 bs=1M count=1024 & [5] 49250 八、查看後臺的任務列表 [root@localhost ~]# jobs [2]- 已中止 dd if=/dev/zero of=/root/file bs=1M count=8190 [4]+ 已中止 dd if=/dev/zero of=/root/file bs=1M count=8190 九、恢復dd if=/dev/zero of=/root/file bs=1M count=8190 讓其在後臺繼續運行 [root@localhost ~]# bg 2 [2]- dd if=/dev/zero of=/root/file bs=1M count=8190 & 十、查詢dd if=/dev/zero of=/root/file bs=1M count=8190 命令的進程並經過kill殺死 [root@localhost ~]# pgrep -l "dd" 2 kthreadd 41 ipv6_addrconf 2189 evolution-addre 2228 evolution-addre 49611 dd [root@localhost ~]# kill -9 49611