Threads in a process

I can see processes with the following command

ps -ef | grep sshd

Open in new window


How do I see the threads that are running within a process ?
Los Angeles1Asked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
A process doesn't have a name.  There is a command and its arguments.

ps -e -o pid,comm | grep command | while read PID CMD
  do
   ps -lm -p $PID
  done

Replace  command with the "name" you're looking for.
0
 
wesly_chenCommented:
ps -eLf
  to see the thread info for all the processes
the do

ps -eLf |grep <PID>
or
ps -eLF | grep   java
0
 
wesly_chenCommented:
Another option is
ps axms
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Los Angeles1Author Commented:
I had looked up the same command but could not get it to work

I cut and pasted from your note and got the following:

# ps -eLf
ps: 0509-048 Flag -p was used with invalid list.
Usage: ps [-AMNZaedfklm] [-n namelist] [-F Format] [-o specifier[=header],...]
                [-p proclist][-G|-g grouplist] [-t termlist] [-U|-u userlist] [-c classlist] [ -T pid] [ -L pidlist ]
                [-@ [wparname] ]
Usage: ps [aceglnsuvwxX] [t tty] [processnumber]
#
#
# ps axms
Usage: ps [-AMNZaedfklm] [-n namelist] [-F Format] [-o specifier[=header],...]
                [-p proclist][-G|-g grouplist] [-t termlist] [-U|-u userlist] [-c classlist] [ -T pid] [ -L pidlist ]
                [-@ [wparname] ]
Usage: ps [aceglnsuvwxX] [t tty] [processnumber]

Open in new window


I can do the following:

# ps -ef | grep sshd
    root 2031644 1442108   0   Sep 08      -  0:00 /usr/sbin/sshd
    root 2687200 2031644   0 14:29:31      -  0:00 sshd: root@pts/0
    root 4063300 2031644   0   Sep 20      -  0:00 sshd: root@pts/2
    root 2359608 2818144   0 17:16:23  pts/0  0:00 grep sshd
    root 3277552 2031644   0 17:15:02      -  0:00 sshd: root@pts/1
#

Open in new window


Something seems to be not quite right

I am using AIX 6.1
0
 
woolmilkporcCommented:
To see the threads for a a particular process id PID under AIX:

ps -lm -p PID

wmp
0
 
wesly_chenCommented:
AIX?
try
ps   am

Also do
man  ps
  and search "thread" for more information.
0
 
Los Angeles1Author Commented:
Is there a way to do that by specifying the process name instead of the PID ?
0
 
wesly_chenCommented:
ps  am |grep  sshd
or
ps  -elm | grep sshd
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.