1.找到进程号
[root@localhost ~]# ps -ef | grep redis redis 1416 1 0 10:15 ? 00:00:02 /www/server/redis/src/redis-server 0.0.0.0:6379 root 11436 10369 0 10:52 pts/0 00:00:00 grep --color=auto redis
2.查看CPU和内存
[root@localhost ~]# top -p 1416 # 按H ,继续按q Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie %Cpu(s): 64.0 us, 5.4 sy, 0.0 ni, 30.6 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 7990032 total, 4015080 free, 1884428 used, 2090524 buff/cache KiB Swap: 8257532 total, 8257532 free, 0 used. 5795472 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1416 redis 20 0 163236 8232 1424 R 0.0 0.1 0:02.95 redis-server
3.查看详细使用信息
[root@localhost ~]# cat /proc/1416/status Name: redis-server Umask: 0022 State: S (sleeping) Tgid: 1416 Ngid: 0 Pid: 1416 PPid: 1 TracerPid: 0 Uid: 1003 1003 1003 1003 Gid: 1003 1003 1003 1003 FDSize: 64 Groups: 1003 VmPeak: 163244 kB VmSize: 163236 kB VmLck: 0 kB VmPin: 0 kB VmHWM: 8332 kB VmRSS: 8232 kB RssAnon: 6808 kB RssFile: 1424 kB RssShmem: 0 kB VmData: 43428 kB VmStk: 132 kB VmExe: 2232 kB VmLib: 3100 kB VmPTE: 76 kB VmSwap: 0 kB Threads: 5 SigQ: 0/31077 SigPnd: 0000000000000000 ShdPnd: 0000000000000000 SigBlk: 0000000000000000 SigIgn: 0000000000003001 SigCgt: 00000001800044ea CapInh: 0000000000000000 CapPrm: 0000000000000000 CapEff: 0000000000000000 CapBnd: 0000001fffffffff CapAmb: 0000000000000000 NoNewPrivs: 0 Seccomp: 0 Speculation_Store_Bypass: thread vulnerable Cpus_allowed: ffffffff,ffffffff,ffffffff,ffffffff Cpus_allowed_list: 0-127 Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001 Mems_allowed_list: 0 voluntary_ctxt_switches: 23186 nonvoluntary_ctxt_switches: 26 [root@localhost ~]#
其他查询
root@localhost ~]# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 125900 4368 ? Ss 10:15 0:01 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 root 2 0.0 0.0 0 0 ? S 10:15 0:00 [kthreadd] root 4 0.0 0.0 0 0 ? S< 10:15 0:00 [kworker/0:0H] root 6 0.0 0.0 0 0 ? S 10:15 0:01 [ksoftirqd/0] root 7 0.0 0.0 0 0 ? S 10:15 0:00 [migration/0] root 8 0.0 0.0 0 0 ? S 10:15 0:00 [rcu_bh] root 9 0.0 0.0 0 0 ? R 10:15 0:02 [rcu_sched] root 10 0.0 0.0 0 0 ? S< 10:15 0:00 [lru-add-drain]
[root@localhost ~]# ps -aux | grep redis redis 1416 0.1 0.1 163236 8232 ? Ssl 10:15 0:03 /www/server/redis/src/redis-server 0.0.0.0:6379 root 12392 0.0 0.0 112832 988 pts/0 R+ 10:56 0:00 grep --color=auto redis