一、经过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