Solved

Threads in a process

Posted on 2011-09-21
8
591 Views
Last Modified: 2013-11-17
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 ?
0
Comment
Question by:Los Angeles1
  • 4
  • 2
  • 2
8 Comments
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36576873
ps -eLf
  to see the thread info for all the processes
the do

ps -eLf |grep <PID>
or
ps -eLF | grep   java
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36576891
Another option is
ps axms
0
 

Author Comment

by:Los Angeles1
ID: 36577008
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 36577034
To see the threads for a a particular process id PID under AIX:

ps -lm -p PID

wmp
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36577053
AIX?
try
ps   am

Also do
man  ps
  and search "thread" for more information.
0
 

Author Comment

by:Los Angeles1
ID: 36577055
Is there a way to do that by specifying the process name instead of the PID ?
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36577076
ps  am |grep  sshd
or
ps  -elm | grep sshd
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 36577084
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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question