0x01: ps -ef only prints processes, while ps -eLf will print all threads
[root@centos6 ~]# ps -ef | grep rsyslogd
root 1470 1 0 2011 ? 00:01:13 /sbin/rsyslogd -c 4
root 29865 28596 0 22:45 pts/5 00:00:00 grep rsyslogd
[root@centos6 ~]# ps -eLf | grep rsyslogd
root 1470 1 1470 0 5 2011 ? 00:00:00 /sbin/rsyslogd -c 4
root 1470 1 28631 0 5 Mar04 ? 00:00:04 /sbin/rsyslogd -c 4
root 1470 1 28632 0 5 Mar04 ? 00:00:01 /sbin/rsyslogd -c 4
root 1470 1 28633 0 5 Mar04 ? 00:00:04 /sbin/rsyslogd -c 4
root 1470 1 28636 0 5 Mar04 ? 00:00:00 /sbin/rsyslogd -c 4
root 29867 28596 29867 0 1 22:45 pts/5 00:00:00 grep rsyslogd
The rsyslogd process has 5 threads, so ps -ef has only one line, while ps -eLf has 5 lines
The meaning of each field of ps -eLf
UID: User ID
PID: process id process id
PPID: parent process id
LWP: Indicates that this is a thread; either the main thread (process) or the thread
NLWP: num of light weight process The number of lightweight processes, that is, the number of threads
STIME: start time
TIME: Total CPU time occupied
TTY: which terminal the process is running in; pts/0255 represents a virtual terminal, which is generally a remotely connected terminal; tty1tty7 represents a local console terminal
CMD: The start command of the process
0x02: top -H -p ${pid} or top -p ${pid} then shitf + H
0x03:cat /proc/${pid}/status 或者 ls /proc/${pid}/task
Where Threads is followed by the number of threads
0x04:pstree -p ${pid}
0x05:ps -hH -p ${pid}
[root@localhost ~]# ps -hH -p 1414
1414 ? Ssl 0:00 /usr/sbin/rsyslogd -n
1414 ? Ssl 0:00 /usr/sbin/rsyslogd -n
1414 ? Ssl 0:00 /usr/sbin/rsyslogd -n