Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Threads in a process

Posted on 2011-09-21
8
Medium Priority
?
605 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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.
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

971 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