ps is a command for printing information about running processes

learn more… | top users | synonyms

63
votes
8answers
6k views

How can I prevent 'grep' from showing up in ps results?

When I search for some process that doesn't exist, e.g. $ ps aux | grep fnord wayne 15745 0.0 0.0 13580 928 pts/6 S+ 03:58 0:00 grep fnord Obviously I ...
33
votes
3answers
3k views

In what order do piped commands run?

I've never really thought about how the shell actually executes piped commands. I've always been told that the "stdout of one program gets piped into the stdin of another," as a way of thinking about ...
28
votes
4answers
48k views

How can I get a full process list in solaris, without truncated lines?

Is there a way to generate a full process listing in solaris, without truncated lines? I've tried the ps command, with the following arguments: -f Generates a full listing. ...
24
votes
3answers
8k views

What are “session leaders” in `ps`?

What are session leaders, as in ps -d which selects all processes except session leaders?
21
votes
2answers
7k views

What do the brackets around processes mean?

mark@mark-VirtualBox:~/auto/lib$ ps -Awwo pid,comm,args PID COMMAND COMMAND 1 init /sbin/init 2 kthreadd [kthreadd] 3 ksoftirqd/0 [ksoftirqd/0] 5 ...
16
votes
2answers
4k views

Why does `htop` show more process than `ps`

In ps xf 26395 pts/78 Ss 0:00 \_ bash 27016 pts/78 Sl+ 0:04 | \_ unicorn_rails master -c config/unicorn.rb 27042 pts/78 Sl+ 0:00 | ...
14
votes
2answers
685 views

When was a process started

To know when was a process started, my first guess was to check the time when /proc/<pid>/cmdline was written/modified the last time. ps also shows a START field. I thought both of these ...
13
votes
5answers
2k views

Can ps display only non kernel processes on Linux?

How can I ask ps to display only user processes and not kernel threads? See this question to see what I mean...
12
votes
3answers
4k views

What would cause ps to report uid instead of username?

I have Eucalyptus installed on my Linux machine, and I've noticed that for processes owned by the eucalyptus user, ps reports the userid instead of the username. For example: $ sudo -i -u eucalyptus ...
10
votes
4answers
20k views

Show top five CPU consuming processes with `ps`

How to show top five CPU consuming processes with ps?
10
votes
2answers
620 views

Which to choose - BSD or Unix-style commands where available?

Commands like ps come with a lot of parameters, especially because they give the use an option to choose between Unix and BSD style flags. I hope you get my point here. So, when there's such an ...
9
votes
2answers
805 views

How does ps know to hide passwords?

Witness: $ ps f PID TTY STAT TIME COMMAND 31509 pts/3 Ss 0:01 -bash 27266 pts/3 S+ 0:00 \_ mysql -uroot -p 25210 pts/10 Ss+ 0:00 /bin/bash 24444 pts/4 Ss 0:00 ...
9
votes
1answer
4k views

Why the value of VSIZE in top is different from the value of VSZ (Virtual set size) in ps?

I know VSZ in ps is for the total address space allocated for the app and is sometimes aliased as vsize (mentioned in man page of ps on linux), but what's the definition of VSIZE in top? This top ...
8
votes
2answers
203 views

Look for a process with a given name

I am trying to convert the VMS command show/system/process=processname into an equivalent Linux command. I tried the following but it returned none of the processes: ps -C /exeimages/processname.pl ...
7
votes
2answers
896 views

grep - why do brackets in grep pattern remove the grep process from ps results?

Why do brackets in a grep pattern remove the grep process from ps results? $ ps -ef | grep XXXX [...] XXXX [...] grep XXXX $ ps -ef | grep [X]XXX [...] XXXX
7
votes
1answer
442 views

Why does “kill -9 0” end my console session?

I just wonder why kill -9 0 ends my tty console session? What exactly is PID 0, it is not listed on a ps aux?
7
votes
2answers
5k views

Top and ps not showing the same cpu result

This is linked to this question. When I run top I get the following result: pid 3038 is using 18% cpu, however when running the result is 5.5%. And this number does not appear to be changing ...
7
votes
3answers
638 views

Elegantly get list of descendant processes

I would like to get a list of all the processes that descend (e.g. children, grand-children, etc) from $pid. This is the simplest way I've come up with: pstree -p $pid | tr "\n" " " |sed "s/[^0-9]/ ...
6
votes
4answers
3k views

Finding the ID of a process and killing it

When ever I need to kill a background process I do ps -e | grep <process_name> Which prints something like this 1766 ? 00:00:13 conky , Then I use the process ID to kill it like so kill 1766 . ...
6
votes
2answers
753 views

Difference between free -m and ps -euf

I'm not an expert on linux so I do apologize in advance for the silly question. I have a vps machine with ubuntu 10.04 and 512Mb of RAM. I'm trying to guess how much memory is available after running ...
6
votes
3answers
2k views

If I see a process running using ps, how can I find the executable?

If I can see a process running using ps -e, how can I find the file which launched it?
6
votes
2answers
3k views

killall gives me `no process found ` but ps

Could somebody explain to me the difference between kill and killall? Why doesn't killall see what ps shows? # ps aux |grep db2 root 1123 0.0 0.8 841300 33956 pts/1 Sl 11:48 0:00 ...
5
votes
5answers
1k views

Piping PS output into a Text file

So what im wanting to do is pretty basic.....but im not sure how to go about it. Lets say I have a program running, but I want to pipe the output of ps -C "ProgramXX" into a file. Normally Running ps ...
5
votes
1answer
8k views

What does this process STAT indicates?

If you check the STAT column in above image you will see Ss S S< SN and R+ What does this indicates ? Process states. If yes,Then what is the significance of 'Ss S< SN and R+'?
5
votes
1answer
126 views

Find all users who have more than N processes and echo them in shell

I'm writing a script in ksh. I need to find all users who have more than N processes and echo them in the shell. N is read from ksh. I know that I should use ps -elf, but how do I parse it, find ...
5
votes
4answers
3k views

Solaris ptree style tool for Linux

I'm looking for the Linux tool that will print the same output as the Solaris ptree. For example: # ptree 538 538 /usr/lib/ssh/sshd 889 /usr/lib/ssh/sshd 890 /usr/lib/ssh/sshd 1498 ...
5
votes
1answer
2k views

What does <defunct> mean in the output of ps?

I had issued the ps -ef|grep java command and this is one of the entries that I got : subhrcho 875 803 0 Jan23 pts/5 00:02:27 [java] <defunct> What is <defunct> implying here ? ...
5
votes
1answer
112 views

What is the meaning of this test expression []? [duplicate]

I've seen someone use command: ps -ef | grep [h]ttpd and Output is: apache 25125 31006 0 21:54 ? 00:00:00 /usr/sbin/httpd apache 26869 31006 0 22:04 ? 00:00:00 ...
4
votes
1answer
93 views

What is the meaning of “1-” in the output of ps?

This is the output of the command ps -ef | grep java on one of our machines. jboss 1965 1935 1 2013 ? 04:41:05 java XXXXXXXXXXXXXXXXX jboss 2170 2141 0 2013 ? 00:42:57 ...
4
votes
3answers
805 views

What does the “interruptible sleep” state indicate?

I had Firefox running on a Parted Magic LiveCD, then (possibly) as a result of a key combination I don't recall, it quickly vanished from screen and Task Bar/Window List. However: ps ax | grep ...
4
votes
3answers
1k views

Terminating a bash shell script running in the background

I often use bash shell scripts to run simple commands for many different files. For example, suppose that I have the following bash shell script, called script.sh, that runs the program/command foo ...
4
votes
2answers
300 views

How to list all running X applications?

I'd like to get a list of all of the apps (across all users) on my machine that are talking to the X server. What's the most reliable way to do that? Find the socket X runs on and lsof for connections ...
4
votes
1answer
88 views

What does `init [2]` mean in the COMMAND column of ps?

Reading What do the brackets around processes mean? I understand that the executable name is printed. Linux ps man page: Sometimes the process args will be unavailable; when this happens, ps will ...
4
votes
3answers
592 views

What's the best way to determine the working directory for UNIX process using 'ps'?

I am running a Ruby command line script (rufus.sh)which ultimately calls Thread.new, which spawns a UNIX process as shown below. I run this script for more than 1 directory as the output of the ps ...
4
votes
1answer
2k views

Elegantly get list of children processes

I would like to get a list of all the processes whose parent is $pid. This is the simplest way I've come up with: pstree -p $pid | tr "\n" " " |sed "s/[^0-9]/ /g" |sed "s/\s\s*/ /g" Is there any ...
4
votes
1answer
1k views

Difference between poll_s and ep_poll WCHAN in ps output

When I issue ps -elf|grep python for example on my system, I see these: 1 S 1000 6020 6008 0 80 0 - 9914 poll_s Jul12 ? 00:00:01 python manage.py run_gunicorn -t 3600 -w 8 -b ...
4
votes
2answers
682 views

Convert PDF from sRGB color space to CMYK

Does anyone know how I can convert a PDF (or EPS) file from sRGB color space to CMYK color space? My workflow is currently the following: Draw an image with Powerpoint Print via postscript printer ...
4
votes
3answers
618 views

Uniquely identifying java processes with same name

I have two java processes which run using the same file name, MyApp.jar (for example). /usr/java/latest/bin/java -jar MyApp.jar These jars exist in different places and use different ...
3
votes
4answers
721 views

How to run java process to be seen not as 'java…' in processes list?

Is it possible to run a Java process in Linux in a way that it could be seen in ps as some sort of alias? It would be easier to restart it when it is down.
3
votes
3answers
155 views

Is there a way to select by several conditions in `ps`?

It seems I am missing something blindingly obvious, but still: ps -f -u myuser --ppid 1 Seems to only take a look at parent pid of the process, and returns all the processes that have parent pid of ...
3
votes
1answer
166 views

init: is it a user thread or a kernel thread?

init is the first task executed after kernel is loaded, right? Then who is its owner. also I can see [swapper/0] [swapper/1] ..... [swapper/7] having pid 0 PID PPID CPU TASK ST %MEM ...
3
votes
1answer
4k views

How to find out total memory resource usage with ps?

With ps command I can find out how much memory each program uses: ps -u mertnuhoglu -o pcpu,rss,pid,command Is it possible to find out the sums of each type of resource usage as well, easily?
3
votes
2answers
1k views

How to list only non-<defunct> processes?

Is there a combination of command-line options for ps or pgrep or some other relatively direct way to determine if a particular process name is actually running (available for normal use).. By ...
3
votes
1answer
83 views

Enumerating\writing files in a specific directory hangs the command

I'm communicating with a machine remotely through ssh. This machine runs a custom-built Linux and it has very limited set of commands. At some point, a specific directory refuses files to be written ...
3
votes
2answers
191 views

Why can't pgrep find scripts started via env?

For example: $ cat foo.sh #!/usr/bin/env bash while true; do sleep 1 ; done $ ./foo.sh & $ pgrep foo.sh $ Contrast with: $ cat bar.sh #!/bin/bash while true; do sleep 1 ; done $ ./bar.sh & ...
3
votes
1answer
41 views

-p and -o comm doesn't work together?

I'm trying to get CPU usage of a process by, ps -p 12990 -o comm=comm,pcpu But that only print the command name (the process does exist), what's wrong with it?
3
votes
1answer
2k views

Understanding ps elapsed time format for long running processes

I'm using a ps command as part of an exercise to identify processes running longer than a given threshold. I'm using the following template to get the elapsed time for a know process command: ps -eo ...
3
votes
2answers
211 views

How to set what field names are displayed in listings?

When I execute a command in Ubuntu, which results in a listing, I get results without the field names. Example is ls -l or ps l. I am not very experienced and always need to go digging through man ...
3
votes
4answers
390 views

Capture complete process structure/stack

There are a lot of java processes running on the server, generally, we capture the PIDs of the java processes using command 'ps -ef | grep java'. In general, the java processes have a lot of jars in ...
3
votes
3answers
170 views

Command line options of rackup are not shown in ps output or procfs

As you know if you wish to get command-line runtime arguments for running command you can parse ps -e or /proc/<pid>/cmdline. But I have encountered issue when this method returns only command ...