linux:linux-commands:process
Process Checking
Output Detailed Process Tree for any User
An easy function to get a process tree listing (very detailed) for all the processes of any gived user.
# psu(){ command ps -Hcl -F S f -u ${1:-$USER}; }
# psu uadmin
F S UID PID PPID CLS PRI ADDR SZ WCHAN RSS PSR STIME TTY TIME CMD
5 S uadmin 23028 23026 TS 18 - 2481 - 1600 0 08:04 ? 0:00 sshd: uadmin@pts/0
0 S uadmin 23029 23028 TS 20 - 1168 - 1464 0 08:04 pts/0 0:01 \_ -bash
Show processes causing high load average
Want to know why your load average is so high? Run this command to see what processes are on the run queue. Runnable processes have a status of “R”, and commands waiting on I/O have a status of “D”.
# ps -eo stat,pid,user,command | egrep "^STAT|^D|^R"
Which program does a port belongs to?
Sometimes you need to use a port that is already opened by some program , and you don't know who to “kill” for it to release - so, now you do !
# lsof -i tcp:22
# lsof -i tcp:80
dstat
dstat - a mix of vmstat, iostat, netstat, ps, sar…
# dstat -ta
vmstat with timestamp
vmstat/iostat with timestamp. Also useful with iostat, or pretty much anything else you want timestamped.
# vmstat 1 | awk '{now=strftime("%Y-%m-%d %T "); print now $0}'
linux/linux-commands/process.txt · Last modified: by 127.0.0.1