ifconfig view network card information
ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.19.147.8 netmask 255.255.240.0 broadcast 172.19.159.255
ether 00:16:3e:04:1c:75 txqueuelen 1000 (Ethernet)
RX packets 554748043 bytes 216708949403 (201.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 468616265 bytes 304896070217 (283.9 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
inet: ip address, netmask: mask address, broadcast: broadcast address.
ping test host connectivity
-c The number of pings
-i time interval for each ping
ping 127.0.0.1 -c 3 -i 10
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.031 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.041 ms
--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 20004ms
rtt min/avg/max/mdev = 0.031/0.037/0.041/0.006 ms
netstat view network status
netstat
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 xxx.xxxxx.com:ssh 183.132.8.2:59640 ESTABLISHED
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 7173 /run/systemd/notify
-t view all tcp
netstat -t
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 xxx.xxxxx.com:ssh 183.132.8.2:59640 ESTABLISHED
-n display address and port number in numeric form
netstat -tn
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 172.19.147.8:22 183.132.8.2:59640 ESTABLISHED
-p displays the pid and name of the process
netstat -tnp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 172.19.147.8:22 183.132.8.2:59640 ESTABLISHED 31014/sshd: 5728360
ps view process
ps
PID TTY TIME CMD
20762 pts/10 00:00:00 bash
22839 pts/10 00:00:00 ps
ps -ef: print all processes
-e: display all processes, same as -A
-f: display UID and other details
ps -ef
UID PID PPID C STIME TTY TIME CMD
root 2 0 0 2020 ? 00:00:08 [kthreadd]
user 23821 20762 0 16:01 pts/10 00:00:00 ps -ef
……
- UID: process owner
- PID: process id
- PPID: the parent process id of this process
- C: percentage of resources occupied by cpu
- STIME: The start time of the process
- TTY: The location of the terminal that initiated the process
- TIME: The execution time of the process
- CMD: the name of the process
ps aux: print all processes
a: Display all programs under the current terminal, including programs of other users
u: Display USER and other detailed information
x: Display all programs, not distinguished by terminal
ps -ef
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2 0.0 0.0 0 0 ? S 2020 0:08 [kthreadd]
user 13984 0.0 0.0 155252 1868 pts/0 R+ 15:01 0:00 ps aux
……
- USER: process owner
- PID: process id
- %CPU: The percentage of resources occupied by cpu
- %MEM: The percentage of resources occupied by memory
- VSZ: virtual memory usage (in KB)
- RSS: the amount of fixed memory occupied (in KB)
- TTY: The location of the terminal that initiated the process
- STAT: process status
- START: The start time of the process
- TIME: The execution time of the process
- COMMAND: the name of the process
STAT: process status
- D Uninterruptible Uninterruptible
- R is running, or a process in the queue
- S is dormant
- T stop or be tracked
- Z zombie process
- X dead process
- < high priority
- n low priority
- s contains child processes
- + process group in the background
- l multi-process
top
Real-time display of process information
top
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2 root 20 0 0 0 0 S 0.0 0.0 0:08.64 kthreadd
7882 jy44865 20 0 166100 5600 596 S 0.3 0.1 309:04.62 top
……
- PID: process id
- USER: process owner
- PR: Priority, PR=NI+20.
- NI: nice value, NI is 0 by default, the smaller the value, the higher the priority.
- VIRT: the virtual memory size of the process
- RES: The physical memory size of the process. Corresponding to %MEM, the size is always smaller than VIRT.
- SHR: The shared memory size of the process. The physical memory of a process includes shared memory and exclusive memory.
- S: process state
- %CPU: The percentage of resources occupied by cpu
- %MEM: The percentage of resources occupied by memory
- TIME+: the execution time of the process
- COMMAND: the name of the process
The difference between ps and top: ps is a static viewing process, top is a dynamic viewing (continuous monitoring) process
kill kill process
kill [pid名称]
Use ps combined with grep to find the process, and kill to clean up the process.