1ps -fp <pid> # find a process by its PID.
2pidof httpd # find the PIDs of httpd.
3pidstat -lp <pid> # process name with all its complete arguments.
4 # for a tomcat or weblogic process, you can split the arguments with: sed 's/ -/\n -/g'
5pidstat -C "mysql" # find a process by its name (gives the PID and CPU load).
1pstree -pu # the process tree with PID and user (if pstree is not installed, use the alternatives below).
1ps -ejH
2 PID PGID SID TTY TIME CMD
3 1 1 1 ? 00:00:37 init
411016 11009 11009 ? 00:00:00 sshd
511017 11017 11017 pts/12 00:00:00 bash
611125 11125 11017 pts/12 00:00:00 telnet
1ps axjf
2 PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
3 0 1 1 1 ? -1 Ss 0 0:37 init [5]
4 8617 10610 10610 10610 ? -1 Ss 0 0:00 \_ sshd: support [priv]
510610 10710 10610 10610 ? -1 S 5027 0:00 \_ sshd: support@notty
610710 10711 10711 10711 ? -1 Ss 5027 0:00 \_ sshd: support@internal-sftp-server
1ps faux
2USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
3root 1 0.0 0.0 10372 696 ? Ss Aug09 0:37 init [5]
4user1 4168 0.0 0.0 8728 968 ? Ss Aug24 0:00 | \_ /bin/bash -c perl /data/supports/scripts/SRAM_asr5k.pl &>/dev/null
5user1 4174 0.0 0.0 34068 5044 ? S Aug24 0:00 | \_ perl /data/supports/SRAM_asr5k.pl
6user1 4188 0.0 0.0 8728 984 ? S Aug24 0:00 | \_ sh -c grep -c SRAM /data/syslogCOLLECT/LTE_*/*/*.20160824.log
The /proc filesystem exposes per-process information:
1# stat /proc/22637/
2 File: `/proc/22637/'
3 Size: 0 Blocks: 0 IO Block: 1024 directory
4Device: 3h/3d Inode: 1935618105 Links: 8
5Access: (0555/dr-xr-xr-x) Uid: ( 1001/ user) Gid: ( 1001/ users)
6Access: 2018-02-11 12:04:54.871001283 +0100
7Modify: 2018-02-11 12:04:54.871001283 +0100
8Change: 2018-02-11 12:04:54.871001283 +0100