五,五胡乱华

五5.1 进程管理
概念
进程:程序运行的过程, 是已经启动的可执行程序的运行实例 线程:操作系统能够调度的最小单位,被包含在进程中,实际运行单位。 一个程序至少一个进程、一个进程

5.1 进程管理

概念

进程:运行程序的进程。这是已启动的可执行程序的运行实例。

线程:操作系统可以调度的最小单位,包含在进程中,是实际的执行单位。

一个程序至少需要一个进程,一个进程至少需要一个线程。

CentOS7 PID进程:systemd

Rocky8 PID进程:systemd

Sample:

[root@lls-18-40 ~]# pstree -p#树打印进程列表

systemd(1)网络管理器(820){网络管理器}(844)

{网络管理员}(849)

VGAuth服务(818)

阿吉蒂(834)

atd(831)

审计(767){审计}(768)

克洛尼德(829)

包含(1143){包含}(1298)

{容器} (1299)

{容器} (1300)

{容器} (1301)

{容器} (1302)

{容器} (1540)

{容器} (1541)

{容器} (1542)

{已包含}(1544)

克朗德(832)

dbus恶魔(800)

多卡德(1545){多卡德} (1550)

{Dockerd}(1551)

{Dockerd}(1552)

{Dockerd}(1553)

{Dockerd}(1554)

{Dockerd}(1555)

{Dockerd}(1688)

{码头}(1689)

gssproxy(803){gssproxy}(804)

{gssproxy}(805)

{gssproxy}(806)

{gssproxy}(807)

{gssproxy}(808)

irqbalance(817)

java(1247){java}(1434)

{Java} (1523)

{Java} (1524)

{Java} (1525)

{Java} (1526)

{Java} (1527)

{Java} (1529)

{Java} (1530)

{Java}(1531)

{Java} (1532)

{Java} (1533)

{Java} (1534)

{Java} (1535)

{Java} (1536)

{Java} (1537)

{Java} (1538)

{Java} (1913)

{Java} (1914)

{Java} (1915)

{Java} (1930)

{Java} (1931)

lvmetad(631)

大师(1399)皮卡(1419)

qmgr(1420)

polkitd(795){polkitd}(809)

{Polkit}(810)

{Polkit}(811)

{Polkit}(812)

{Polkit}(813)

{Polkit}(814)

rpcbind(802)

rsyslogd(1134){rsyslogd}(1258)

{rsyslogd}(1267)

sshd(1132)sshd(1815)bash(1886)pstree(1932)

systemd-journal(603)

systemd-logind(798)

systemd-udevd(642)systemd-udevd(1927)

超时(1248)bash(1251)睡眠(1922)

调音(1133){调音}(1729)

{调音} (1730)

{调音} (1733)

{调整}(1734)

vmtoolsd(819){vmtoolsd}(841)

{vmtoolsd}(893)

5.2 进程的常用属性

概念

进程ID (PID):用于区分进程的唯一值。

父进程ID (PPID)

启动进程的用户ID(UID)和进程所属的组(GID)

进程状态:状态分为运行R(运行)和睡眠S(睡眠)。

进程执行优先级

进程连接的终端名称

进程资源使用情况:资源大小(内存、CPU使用率)等。

Sample:

[root@lls-18-40 ~]# ps #当前终端

PID TTY 时间CMD

1886 点/0 00:00:00 巴什

2032 点/0 00:00:00 ps

[root@lls-18-40 ~]# w #显示虚拟终端

17:52:56 上线5 分钟,1 个用户,平均负载: 0.05、0.22、0.13

登录的用户TTY@ IDLE JCPU PCPU WHAT

路由点/0 192.168.4.89 17:47 0.00 秒0.01 秒0.00 秒w

[root@lls-18-40 ~]# ps #执行后PID会更新

PID TTY 时间CMD

1886 点/0 00:00:00 巴什

2040 点/0 00:00:00 ps

ps aux| more #a 所有进程 u 基于用户 x没有终端也显示

/var/spool/mail/root 有新邮件

[root@lls-18-40 ~]# ps aux| 基于用户x u 的所有进程也会出现,无需终端

用户PID %CPU %MEM VSZ RSS TTY STAT 启动时间命令

根1 0.1 0.0 191172 4104 ? Ss 17:47 0:00 /usr/lib/systemd/systemd –switched-root –system –deserialize 22

根2 0.0 0.0 0 0 ? S 17:47 0:00 [kthread]

路线4 0.0 0.0 0 0 ? S 17:47 0:00 [kworker/0:0H]

根6 0.0 0.0 0 0 ? S 17:47 0:00 [ksoftirqd/0]

路线7 0.0 0.0 0 0 ? S 17:47 0:00 [迁移/0]

根8 0.0 0.0 0 0 ? S 17:47 0:00 [rcu_bh]

根9 0.0 0.0 0 0 ? S 17:47 0:00 [rcu_sched]

根10 0.0 0.0 0 0 ? S 17:47 0:00 [lru-add-drain]

路线11 0.0 0.0 0 0 ? S 17:47 0:00 [看门狗/0]

路线12 0.0 0.0 0 0 ? S 17:47 0:00 [看门狗/1]

路线13 0.0 0.0 0 0 ? S 17:47 0:00 [迁移/1]

根14 0.0 0.0 0 0 ? S 17:47 0:00 [ksoftirqd/1]

路线16 0.0 0.0 0 0 ? S 17:47 0:00 [kworker/1:0H]

路线17 0.0 0.0 0 0 ? S 17:47 0:00 [看门狗/2]

路线18 0.0 0.0 0 0 ? S 17:47 0:00 [迁移/2]

根19 0.0 0.0 0 0 ? S 17:47 0:00 [ksoftirqd/2]

路线21 0.0 0.0 0 0 ? S 17:47 0:00 [kworker/2:0H]

路线22 0.0 0.0 0 0 ? S 17:47 0:00 [看门狗/3]

路线23 0.0 0.0 0 0 ? S 17:47 0:00 [迁移/3]

根24 0.0 0.0 0 0 ? S 17:47 0:00 [ksoftirqd/3]

路线26 0.0 0.0 0 0 ? S 17:47 0:00 [kworker/3:0H]

根28 0.0 0.0 0 0 ? S 17:47 0:00 [kdevtmpfs]

29号公路0.0 0.0 0 0 ? S 17:47 0:00 [净]

根30 0.0 0.0 0 0 ? S 17:47 0:00 [昆图斯克]

根31 0.0 0.0 0 0 ? S 17:47 0:00 [写回]

根32 0.0 0.0 0 0 ? S 17:47 0:00 [完整性]

根33 0.0 0.0 0 0 ? S 17:47 0:00 [Bioset]

根34 0.0 0.0 0 0 ? S 17:47 0:00 [Bioset]

根35 0.0 0.0 0 0 ? S 17:47 0:00 [Bioset]

根36 0.0 0.0 0 0 ? S 17:47 0:00 [kblockd]

根37 0.0 0.0 0 0 ? S 17:47 0:00 [md]

根38 0.0 0.0 0 0 ? S 17:47 0:00 [edac-poller]

路线39 0.0 0.0 0 0 ? S 17:47 0:00 [看门狗]

根40 0.0 0.0 0 0 ? S 17:47 0:00 [kworker/3:1]

根45 0.0 0.0 0 0 ? S 17:47 0:00 [kswapd0]

路线46 0.0 0.0 0 0 SN 17:47 0:00 [ksmd]

47号公路0.0 0.0 0 0 ? SN 17:47 0:00 [库格页]

根48 0.0 0.0 0 0 ? S 17:47 0:00 [密码]

路线56 0.0 0.0 0 0 ? S 17:47 0:00 [kthrotld]

路线58 0.0 0.0 0 0 ? S 17:47 0:00 [kmpath_rdacd]

59 号公路0.0 0.0 0 0 ? S 17:47 0:00 [卡拉多]

61 号公路0.0 0.0 0 0 ? S 17:47 0:00 [kpsmoused]

根62 0.0 0.0 0 0 ? S 17:47 0:00 [kworker/0:2]

路线63 0.0 0.0 0 0 ? S 17:47 0:00 [ipv6_addrconf]

根76 0.0 0.0 0 0 ? S 17:47 0:00 [deferwq]

根77 0.0 0.0 0 0 ? S 17:47 0:00 [kworker/1:1]

根114 0.0 0.0 0 0 ? S 17:47 0:00 [考迪]

/var/spool/mail/root 有新邮件

ps -elf|more #e所有、f完整显示、l列出

[root@VM-0-3-rockylinux ~]# ps -elf|more #e 全部,f 完整,l 列表

F SUID PID PPID C PRI NI 地址SZ WCHAN STIME TTY TIME CMD

4 S root 1 0 0 80 0 – 43479 do_epo Jun25 ? 00:01:28 /usr/lib/systemd/systemd –switched-root –system –deserialize 17

1 S 路线2 0 0 80 0 – 0 – Jun25 00:00:00 [kthreadd]

1根3 2 0 60 -20 – 0 – Jun25 00:00:00 [rcu_gp]

1 I 路线4 2 0 60 -20 – 0 – Jun25 00:00:00 [rcu_par_gp]

1根5 2 0 60 -20 – 0 – Jun25 00:00:00 [slub_flushwq]

1 I 路线7 2 0 60 -20 – 0 – Jun25 00:00:00 [kworker/0:0H-events_highpri]

1 我的路线10 2 0 60 -20 – 0 – Jun25 00:00:00 [mm_percpu_wq]

1 S 路线11 2 0 80 0 – 0 – Jun25 00:00:00 [rcu_tasks_rude_]

1 S 路线12 2 0 80 0 – 0 – Jun25 00:00:00 [rcu_tasks_trace]

1 S 路由13 2 0 80 0 – 0 – Jun25 00:00:02 [ksoftirqd/0]

1 我的路线14 2 0 80 0 – 0 – Jun25 00:00:38 [rcu_sched]

1 S 路线15 2 0 -40 – – 0 – Jun25 00:00:00 [迁移/0]

5 S 路线16 2 0 -40 – – 0 – Jun25 00:00:00 [看门狗/0]

1 S 路线17 2 0 80 0 – 0 – Jun25 00:00:00 [cpuhp/0]

1 S 路线18 2 0 80 0 – 0 – Jun25 00:00:00 [cpuhp/1]

5 S 路线19 2 0 -40 – – 0 – Jun25 00:00:00 [看门狗/1]

1 S 路线20 2 0 -40 – – 0 – Jun25 00:00:00 [迁移/1]

1 S 路线21 2 0 80 0 – 0 – Jun25 00:00:02 [ksoftirqd/

1]
1 I root 23 2 0 60 -20 – 0 – Jun25 ? 00:00:00 [kworker/1:0H-events_highpri]
1 S root 24 2 0 80 0 – 0 – Jun25 ? 00:00:00 [cpuhp/2]

ps -aux –sort -pcpu|more #排列给出cpu占比

[root@VM-0-3-rockylinux ~]# ps -aux –sort -pcpu|more #排列给出cpu占比
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 8245 2.9 7.7 1818180 598240 ? Ssl Jun25 83:57 /usr/local/bin/k3s server
root 1869 0.7 0.2 605256 20852 ? Sl Jun25 20:30 barad_agent
root 4031 0.5 1.9 1103992 149296 ? Sl Jun25 17:12 /usr/local/qcloud/YunJing/YDEyes/YDService
root 8319 0.5 2.2 1468196 172008 ? Sl Jun25 15:40 containerd
root 788 0.3 0.4 560572 34472 ? Ssl Jun25 10:44 /usr/libexec/platform-python -Es /usr/sbin/tuned -l -P
systemd+ 398947 0.3 7.2 4427448 560020 ? Ssl Jun26 6:16 /opt/java/openjdk/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoade
rLogManager -Xms256m -Xmx768m -Djavax.net.ssl.trustStore=/home/cacservice/cacerts -Djava.security.egd=file:/dev/./urandom -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dor
g.apache.catalina.security.SecurityListener.UMASK=0027 -Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dignore.endorsed.di
rs= -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
1000 346428 0.2 0.7 759540 56020 ? Ssl Jun26 5:39 /metrics-server –cert-dir=/tmp –secure-port=10250 –kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname –kubelet-use-node-status-port –metri
c-resolution=15s –tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20
_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
65532 398610 0.2 1.2 919644 97736 ? Ssl Jun26 3:40 /app/cm
root 346980 0.1 0.7 764912 56508 ? Ssl Jun26 2:16 /coredns -conf /etc/coredns/Corefile
root 1 0.0 0.1 173916 11888 ? Ss Jun25 1:28 /usr/lib/systemd/systemd –switched-root –system –deserialize 17
root 2 0.0 0.0 0 0 ? S Jun25 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I< Jun25 0:00 [rcu_gp]
root 4 0.0 0.0 0 0 ? I< Jun25 0:00 [rcu_par_gp]
root 5 0.0 0.0 0 0 ? I< Jun25 0:00 [slub_flushwq]
root 7 0.0 0.0 0 0 ? I< Jun25 0:00 [kworker/0:0H-events_highpri]
root 10 0.0 0.0 0 0 ? I< Jun25 0:00 [mm_percpu_wq]
root 11 0.0 0.0 0 0 ? S Jun25 0:00 [rcu_tasks_rude_]
root 12 0.0 0.0 0 0 ? S Jun25 0:00 [rcu_tasks_trace]
root 13 0.0 0.0 0 0 ? S Jun25 0:02 [ksoftirqd/0]
root 14 0.0 0.0 0 0 ? I Jun25 0:38 [rcu_sched]
root 15 0.0 0.0 0 0 ? S Jun25 0:00 [migration/0]
root 16 0.0 0.0 0 0 ? S Jun25 0:00 [watchdog/0]
root 17 0.0 0.0 0 0 ? S Jun25 0:00 [cpuhp/0]
root 18 0.0 0.0 0 0 ? S Jun25 0:00 [cpuhp/1]
root 19 0.0 0.0 0 0 ? S Jun25 0:00 [watchdog/1]
root 20 0.0 0.0 0 0 ? S Jun25 0:00 [migration/1]
root 21 0.0 0.0 0 0 ? S Jun25 0:02 [ksoftirqd/1]
root 23 0.0 0.0 0 0 ? I< Jun25 0:00 [kworker/1:0H-events_highpri]
root 24 0.0 0.0 0 0 ? S Jun25 0:00 [cpuhp/2]
root 25 0.0 0.0 0 0 ? S Jun25 0:00 [watchdog/2]
root 26 0.0 0.0 0 0 ? S Jun25 0:00 [migration/2]
root 27 0.0 0.0 0 0 ? S Jun25 0:02 [ksoftirqd/2]
root 29 0.0 0.0 0 0 ? I< Jun25 0:00 [kworker/2:0H-events_highpri]
root 30 0.0 0.0 0 0 ? S Jun25 0:00 [cpuhp/3]
root 31 0.0 0.0 0 0 ? S Jun25 0:00 [watchdog/3]
root 32 0.0 0.0 0 0 ? S Jun25 0:00 [migration/3]
root 33 0.0 0.0 0 0 ? S Jun25 0:02 [ksoftirqd/3]
root 35 0.0 0.0 0 0 ? I< Jun25 0:00 [kworker/3:0H-events_highpri]
root 40 0.0 0.0 0 0 ? S Jun25 0:00 [kdevtmpfs]
root 41 0.0 0.0 0 0 ? I< Jun25 0:00 [netns]
root 42 0.0 0.0 0 0 ? S Jun25 0:00 [kauditd]
root 44 0.0 0.0 0 0 ? S Jun25 0:00 [khungtaskd]
root 45 0.0 0.0 0 0 ? S Jun25 0:00 [oom_reaper]
root 46 0.0 0.0 0 0 ? I< Jun25 0:00 [writeback]
[root@VM-0-3-rockylinux ~]#

ps -aux –sort -rss|more #排列给出MEM占比

[root@VM-0-3-rockylinux ~]# ps -aux –sort -rss|more #排列给出MEM占比
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 8245 2.9 7.7 1818564 598608 ? Ssl Jun25 84:00 /usr/local/bin/k3s server
systemd+ 398947 0.3 7.2 4427448 560020 ? Ssl Jun26 6:17 /opt/java/openjdk/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoade
rLogManager -Xms256m -Xmx768m -Djavax.net.ssl.trustStore=/home/cacservice/cacerts -Djava.security.egd=file:/dev/./urandom -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dor
g.apache.catalina.security.SecurityListener.UMASK=0027 -Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dignore.endorsed.di
rs= -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
root 503 0.0 2.3 312252 178364 ? Ss Jun25 0:27 /usr/lib/systemd/systemd-journald
root 8319 0.5 2.2 1468196 171644 ? Sl Jun25 15:40 containerd
root 4031 0.5 1.9 1103992 149296 ? Sl Jun25 17:12 /usr/local/qcloud/YunJing/YDEyes/YDService
root 1020 0.0 1.3 417952 103356 ? Ssl Jun25 0:18 /usr/sbin/rsyslogd -n
65532 398610 0.2 1.2 919644 97632 ? Ssl Jun26 3:40 /app/cm
root 346980 0.1 0.7 764912 56772 ? Ssl Jun26 2:16 /coredns -conf /etc/coredns/Corefile
1000 346428 0.2 0.7 759540 55748 ? Ssl Jun26 5:39 /metrics-server –cert-dir=/tmp –secure-port=10250 –kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname –kubelet-use-node-status-port –metri
c-resolution=15s –tls-cipher-suites=TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20
_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
65532 561554 0.0 0.6 62588 49456 ? S Jun26 0:09 ./awc_health
101 398574 0.0 0.6 1270172 48928 ? Ssl Jun26 0:40 /nginx-ingress-controller –annotations-prefix=nginx.ingress.kubernetes.io –configmap=ingress-nginx/nginx-ingress –controller-class=k8s.io/ingress-nginx
–default-ssl-certificate=ingress-nginx/nginx-ingress-certificate –publish-service=ingress-nginx/nginx-ingress –tcp-services-configmap=ingress-nginx/tcp-services –udp-services-configmap=ingress-nginx/udp-services
65532 470600 0.0 0.5 48256 41428 ? S Jun26 0:07 ./service
65532 470601 0.0 0.5 48236 41352 ? S Jun26 0:07 ./service
65532 398892 0.0 0.5 48588 41288 ? S Jun26 0:03 ./service
root 788 0.3 0.4 560572 34472 ? Ssl Jun25 10:44 /usr/libexec/platform-python -Es /usr/sbin/tuned -l -P
root 346960 0.0 0.4 1265432 33616 ? Ssl Jun26 0:06 local-path-provisioner start –config /etc/config/config.json
65532 398862 0.0 0.4 180500 33340 ? Sl Jun26 0:57 ./service
101 399699 0.0 0.3 189456 28080 ? Sl Jun26 0:15 nginx: worker process
polkitd 990 0.0 0.3 1745140 25608 ? Ssl Jun25 0:03 /usr/lib/polkit-1/polkitd –no-debug
root 1869 0.7 0.2 605256 20852 ? Sl Jun25 20:31 barad_agent
101 399378 0.0 0.2 176008 20440 ? S Jun26 0:00 nginx: master process /usr/bin/nginx -c /etc/nginx/nginx.conf
root 1809 0.0 0.2 1472736 20328 ? Sl Jun25 0:34 /usr/local/qcloud/YunJing/YDLive/YDLive
root 784 0.0 0.2 381392 18608 ? Ssl Jun25 0:02 /usr/sbin/NetworkManager –no-daemon

top动态查看

top – 18:19:50 up 2 days, 22 min, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 165 total, 2 running, 163 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.8 us, 0.3 sy, 0.0 ni, 98.7 id, 0.1 wa, 0.0 hi, 0.1 si, 0.0 st
MiB Mem : 7559.2 total, 513.7 free, 1890.4 used, 5155.2 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 5365.3 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8245 root 20 0 1817476 597500 131892 S 2.3 7.7 84:01.66 k3s-server
1869 root 20 0 605256 20852 6336 S 0.7 0.3 20:31.60 barad_agent
788 root 20 0 560572 34472 18648 S 0.3 0.4 10:44.66 tuned
1809 root 20 0 1472736 20036 8376 S 0.3 0.3 0:35.00 YDLive
4031 root 20 0 1103992 148860 28744 S 0.3 1.9 17:12.78 YDService
8319 root 20 0 1468196 171644 106944 S 0.3 2.2 15:40.84 containerd
346428 1000 20 0 759540 55356 31540 S 0.3 0.7 5:39.51 metrics-server
398785 4172 20 0 848652 11192 7684 S 0.3 0.1 0:32.26 SecurityGateway
1256833 root 20 0 0 0 0 I 0.3 0.0 0:00.43 kworker/3:2-events
1260164 root 20 0 59396 4680 3872 R 0.3 0.1 0:00.01 top
1 root 20 0 173916 11888 8044 S 0.0 0.2 1:29.03 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.07 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
5 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 slub_flushwq
7 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-events_highpri
10 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tasks_rude_
12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tasks_trace
13 root 20 0 0 0 0 S 0.0 0.0 0:02.81 ksoftirqd/0
14 root 20 0 0 0 0 I 0.0 0.0 0:38.90 rcu_sched
15 root rt 0 0 0 0 S 0.0 0.0 0:00.61 migration/0
16 root rt 0 0 0 0 S 0.0 0.0 0:00.27 watchdog/0

[root@lls-18-40 ~]# uptime #启动时间查看
18:20:47 up 33 min, 1 user, load average: 0.00, 0.02, 0.05
#系统负载,即任务队列的平均长度。 三个数值分别为 1分钟、5分钟、15分钟前到现在的平均值。

[root@lls-18-40 ~]# ps aux | grep vim
root 2974 0.0 0.1 149416 5120 pts/0 S+ 19:59 0:00 vim /etc/resolv.conf
root 3003 0.0 0.0 112808 976 pts/1 S+ 20:00 0:00 grep –color=auto vim
[root@lls-18-40 ~]# top -p 2974
top – 20:00:39 up 2:13, 2 users, load average: 0.00, 0.01, 0.05
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.1 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 4912184 total, 3233164 free, 1282932 used, 396088 buff/cache
KiB Swap: 4194300 total, 4194300 free, 0 used. 3394104 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2974 root 20 0 149416 5120 2604 S 0.0 0.1 0:00.03 vim
[root@lls-18-40 ~]# ps aux|grep bash
root 1886 0.0 0.0 115544 2092 pts/0 Ss 17:47 0:00 -bash
root 2977 0.0 0.0 115544 2080 pts/1 Ss 19:59 0:00 -bash
root 3031 0.0 0.0 112808 972 pts/1 S+ 20:02 0:00 grep –color=auto bash
[root@lls-18-40 ~]# pstree -p|grep bash
|-sshd(1132)-+-sshd(1815)—bash(1886)—vim(2974)
| `-sshd(2975)—bash(2977)-+-grep(3040)
You have new mail in /var/spool/mail/root
[root@lls-18-40 ~]# ps aux|grep bash
root 1886 0.0 0.0 115544 2092 pts/0 Ss 17:47 0:00 -bash
root 2977 0.0 0.0 115544 2088 pts/1 Ss 19:59 0:00 -bash
root 3047 0.0 0.0 112808 972 pts/1 S+ 20:04 0:00 grep –color=auto bash
[root@lls-18-40 ~]# w #看虚机终端
20:05:53 up 2:18, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.4.89 17:47 6:33 0.05s 0.03s vim /etc/resolv.conf
root pts/1 192.168.4.89 19:59 1.00s 0.01s 0.00s w
You have new mail in /var/spool/mail/root
[root@lls-18-40 ~]# tty #显示终端号
/dev/pts/1
[root@lls-18-40 ~]#

top 命令:

输入大p,按照CPU排序;输入大M,按照MEM排序;大T,按照时间排序;Q退出;3秒刷新;S改变刷新时间

top – 20:08:55 up 2:21, 2 users, load average: 0.00, 0.01, 0.05
Tasks: 191 total, 1 running, 190 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.1 us, 0.0 sy, 0.0 ni, 99.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 4912184 total, 3236528 free, 1279064 used, 396592 buff/cache
KiB Swap: 4194300 total, 4194300 free, 0 used. 3397732 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1247 pcoip_l+ 20 0 5071748 999.9m 26212 S 1.0 20.8 2:05.50 java
1545 root 20 0 1103304 67824 27200 S 0.0 1.4 0:00.88 dockerd
1143 root 20 0 1627344 30684 14484 S 0.0 0.6 0:02.13 containerd
1133 root 20 0 574284 19504 6136 S 0.0 0.4 0:00.81 tuned
795 polkitd 20 0 612240 11072 4652 S 0.0 0.2 0:00.15 polkitd
820 root 20 0 474308 10676 6684 S 0.0 0.2 0:00.54 NetworkManager
1134 root 20 0 222740 6584 4200 S 0.0 0.1 0:00.47 rsyslogd
1815 root 20 0 161772 6120 4732 S 0.0 0.1 0:00.07 sshd
2975 root 20 0 161772 6120 4732 S 0.0 0.1 0:00.04 sshd
2974 root 20 0 149416 5120 2604 S 0.0 0.1 0:00.03 vim
818 root 20 0 168148 5052 3636 S 0.0 0.1 0:00.01 VGAuthService
819 root 20 0 348804 4980 3680 S 0.3 0.1 0:05.57 vmtoolsd
2749 postfix 20 0 90020 4736 3664 S 0.0 0.1 0:00.01 local
603 root 20 0 39056 4424 4096 S 0.0 0.1 0:00.34 systemd-journal
1132 root 20 0 113004 4336 3304 S 0.0 0.1 0:00.00 sshd
2746 postfix 20 0 90060 4156 3140 S 0.0 0.1 0:00.01 cleanup
1420 postfix 20 0 89980 4120 3112 S 0.0 0.1 0:00.05 qmgr

#以上关于五的相关内容来源网络仅供参考,相关信息请以官方公告为准!

原创文章,作者:CSDN,如若转载,请注明出处:https://www.sudun.com/ask/92631.html

Like (0)
CSDN的头像CSDN
Previous 2024年6月27日
Next 2024年6月27日

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注