個人的に良く使うLinuxコマンド
psで特定のコマンドの情報を見る
nginxの情報を見る例
ps -Cnginx ufw
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 5655 0.0 0.0 77396 528 ? Ss 7月29 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 14377 0.0 0.1 83544 3304 ? S 8月05 2:16 \_ nginx: worker process
nginx 14378 0.0 0.2 83476 5352 ? S 8月05 2:10 \_ nginx: worker process
nginx 14380 0.0 0.1 83520 3336 ? S 8月05 2:13 \_ nginx: worker process
nginx 14381 0.0 0.0 77400 404 ? S 8月05 0:03 \_ nginx: cache manager process
topに実行コマンド名を表示する
ec2でec2-userが実行中のコマンドを見る例
top -d1 -c -Uec2-user
Tasks: 91 total, 1 running, 90 sleeping, 0 stopped, 0 zombie
Cpu(s): 5.9%us, 14.7%sy, 0.0%ni, 79.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 7663344k total, 6039796k used, 1623548k free, 127932k buffers
Swap: 0k total, 0k used, 0k free, 396680k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
28119 ec2-user 20 0 15140 1288 968 R 1.0 0.0 0:00.02 top -d1 -c -Uec2-user
2767 ec2-user 20 0 40424 17m 912 S 0.0 0.2 163:41.66 tmux -2
3642 ec2-user 20 0 112m 2204 1632 S 0.0 0.0 0:00.20 -bash
9100 ec2-user 20 0 116m 1412 748 S 0.0 0.0 0:00.24 -bash
12228 ec2-user 20 0 112m 2136 1600 S 0.0 0.0 0:00.02 -bash
19603 ec2-user 20 0 108m 1960 952 S 0.0 0.0 0:00.26 sshd: ec2-user@pts/0
19604 ec2-user 20 0 112m 2180 1620 S 0.0 0.0 0:00.17 -bash
27065 ec2-user 20 0 116m 1900 1264 S 0.0 0.0 0:00.81 -bash
27193 ec2-user 20 0 108m 1956 948 S 0.0 0.0 0:00.00 sshd: ec2-user@pts/6
27194 ec2-user 20 0 112m 2112 1592 S 0.0 0.0 0:00.00 -bash
27513 ec2-user 20 0 21872 1144 860 S 0.0 0.0 0:00.00 tmux
27514 ec2-user 20 0 112m 2160 1616 S 0.0 0.0 0:00.12 -bash
27900 ec2-user 20 0 223m 22m 1072 S 0.0 0.3 0:01.21 salepoller.syslogify
29978 ec2-user 20 0 112m 2204 1628 S 0.0 0.0 0:00.16 -bash
network statusにpidとコマンド名も表示する
sudo netstat -lnatp
コメント