The two standard tools to show process informations are ps and top (and htop which is similar/improved).
Notes:
- Many program change the apparent name of the threads to something meaningful, the tools below can either display the binary name or that apparent name (check PID 1086 in the examples below).
- In the examples below, I have removed most process to keep the answer short.
- The command arguments example below are common ones. check the manpage for alternate options (
ps -m, ps m, ps H...)
Realtime view of all or process, using top -H
top - 16:24:42 up 3:49, 3 users, load average: 0.23, 0.29, 0.31
Threads: 503 total, 2 running, 501 sleeping, 0 stopped, 0 zombie
%Cpu(s): 9.7 us, 1.6 sy, 0.0 ni, 88.5 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 3938668 total, 2148708 used, 1789960 free, 133524 buffers
KiB Swap: 3903484 total, 0 used, 3903484 free. 822904 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1054 root 20 0 258664 3524 2692 S 0.0 0.1 0:00.00 rsyslogd
1086 root 20 0 258664 3524 2692 S 0.0 0.1 0:00.03 in:imuxsock
1087 root 20 0 258664 3524 2692 S 0.0 0.1 0:00.00 in:imklog
1090 root 20 0 258664 3524 2692 S 0.0 0.1 0:00.05 rs:main Q:Reg
2452 fpiat 20 0 25292 7520 3580 S 0.0 0.2 0:00.69 bash
2495 fpiat 20 0 25088 6988 3256 S 0.0 0.2 0:00.05 bash
Instant view of all process and threads, using ps -eLf
$ ps -eLf
UID PID PPID LWP C NLWP STIME TTY TIME CMD
root 1054 1 1054 0 4 12:34 ? 00:00:00 /usr/sbin/rsyslogd -n
root 1054 1 1086 0 4 12:34 ? 00:00:00 /usr/sbin/rsyslogd -n
root 1054 1 1087 0 4 12:34 ? 00:00:00 /usr/sbin/rsyslogd -n
root 1054 1 1090 0 4 12:34 ? 00:00:00 /usr/sbin/rsyslogd -n
franklin 2452 2448 2452 0 1 12:35 pts/0 00:00:00 /bin/bash
franklin 2495 2448 2495 0 1 12:36 pts/1 00:00:00 /bin/bash
Threads information of a process, using ps -T
ps -T -C rsyslogd
PID SPID TTY TIME CMD
1054 1054 ? 00:00:00 rsyslogd
1054 1086 ? 00:00:00 in:imuxsock
1054 1087 ? 00:00:00 in:imklog
1054 1090 ? 00:00:00 rs:main Q:Reg
(note: use either option -C command, or -p PID to select the process)
Details threads information of a process, using custom ps
$ ps -L -o pid,lwp,pri,nice,start,stat,bsdtime,cmd,comm -C rsyslogd
PID LWP PRI NI STARTED STAT TIME CMD COMMAND
1054 1054 19 0 12:34:53 Ssl 0:00 /usr/sbin/rsyslogd -n rsyslogd
1054 1086 19 0 12:34:53 Ssl 0:00 /usr/sbin/rsyslogd -n in:imuxsock
1054 1087 19 0 12:34:53 Ssl 0:00 /usr/sbin/rsyslogd -n in:imklog
1054 1090 19 0 12:34:53 Ssl 0:00 /usr/sbin/rsyslogd -n rs:main Q:Reg