This article summarizes frequently used Unix-like system commands for daily development, troubleshooting, and system monitoring. Each command includes practical usage examples and brief explanations to help you quickly find and understand essential tools.
Commands
tcpdump
1
sudo tcpdump -i any src port 13400 or dst port 13400
mount
1
mount -o remount,rw <path>
ps (process status)
1
2
3
4
5
6
ps aux | grep <-i> <xxx>
# check related precess information and reserver first line.ps -eo pid,ppid,user,cmd | awk 'NR==1 || /<key_word>/'| less -S
# sz: viture memory usage, unit: page/4k, ps -eo pid,ppid,user,cmd,pcpu,sz,rss | awk 'NR==1 || /<key_word>/'| less -S
vmstat
1
2
#check virtual memory usagevmstat -Sm 1
top
Type Shift + P: Sort by CPU load in descending order
Type Shift + M: Sort by memory usage in descending order
Type c: Show complete command.
Type E: Switching unit.
Network
1
2
3
4
5
6
7
8
9
10
lsof -i :<port> # check port's process# -t: TCP, -u: UDP, -l: only listening, -n: don't parse servername, # -p: show port process informationss -tulnp | grep <"process name">
ss -tulnp | grep <":port">
# show first line titless -an | awk 'NR==1 || /:13400/'