(1) Check the process that consumes the most CPU
Method One:
Core directive: PS
Actual command:
PS H-eo pid,pcpu | Sort-nk2 | Tail
The following results are performed:
[Email protected] ~]$ PS H-eo pid,pcpu | Sort-nk2 | Tail
31396 0.6
31396 0.6
31396 0.6
31396 0.6
31396 0.6
31396 0.6
31396 0.6
31396 0.6
30904 1.0
30914 1.0
Results:
See, the most CPU-intensive pid=30914 (actually 31396)
Method Two:
Core directive: Top
Actual command:
Top
Shift + t
(2) on the basis of (1), what is the corresponding service name?
Method One:
Core directive: PS
Actual command:
PS aux | Fgrep PID
The following results are performed:
[[Email protected] ~]$ PS aux | Fgrep 30914
Work 30914 1.0 0.8 309568 71668? Sl Feb02 124:44./router2–conf=rs.conf
Results:
See, the process is./router2
Method Two:
Core directive: ... No, check proc directly.
Actual command:
Ll/proc/pid
The following results are performed:
[Email protected] ~]$ ll/proc/30914
lrwxrwxrwx 1 Work Work 0 13:27 CWD--/home/work/im-env/router2
lrwxrwxrwx 1 Work Work 0 13:27 exe--/home/work/im-env/router2/router2
Results:
This is good, the whole path is out.
(3) View a port's connection status
Method One:
Core directive: Netstat
Actual command:
Netstat-lap | Fgrep Port
The following results are performed:
[Email protected] ~]$ Netstat-lap | Fgrep 22022
TCP 0 0 10.58.xxx.29:22022 *:* LISTEN 31396/imui
TCP 0 0 10.58.xxx.29:22022 10.58.xxx.29:46642 established 31396/imui
TCP 0 0 10.58.xxx.29:22022 10.58.xxx.29:46640 established 31396/imui
Method Two:
Core directive: lsof
Actual command:
Lsof-i:p ORT
The following results are performed:
[[email protected] ~]$/usr/sbin/lsof-i: 22022
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
Router 30904 work 50u IPv4 69065770 TCP 10.58.xxx.29:46638->10.58.xxx.29:22022 (established)
Router 30904 work 51u IPv4 69065772 TCP 10.58.xxx.29:46639->10.58.xxx.29:22022 (established)
Router 30904 work 52u IPv4 69065774 TCP 10.58.xxx.29:46640->10.58.xxx.29:22022 (established)
(4) to be continued ...
Common commands for tracing online problems under Linux