ps is a command for printing information about running processes

learn more… | top users | synonyms

65
votes
8answers
7k 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 ...
36
votes
4answers
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 ...
30
votes
4answers
54k 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. ...
25
votes
3answers
9k views

What are “session leaders” in `ps`?

What are session leaders, as in ps -d which selects all processes except session leaders?
22
votes
2answers
8k 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 ...
18
votes
2answers
5k 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 | ...
15
votes
2answers
1k 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 ...
15
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
5k 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 ...
11
votes
5answers
27k views

Show top five CPU consuming processes with `ps`

How to show top five CPU consuming processes with ps?
11
votes
2answers
660 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
1k 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
216 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
8k 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
2answers
932 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
491 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
3answers
923 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
1answer
9k 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+'?
6
votes
2answers
844 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
2k 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
127 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
3answers
1k 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 ...
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
121 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 ...
5
votes
1answer
517 views

How to identify executable path with its PID on AIX 5 or more

On AIX 5 or 6, `ps -ef` shows the executable full path randomly. Why and how to determine it? I find many thread through internet and also Unix & Linux and this stack overflow post about finding ...
4
votes
4answers
183 views

Single instance of script, but only with same arguments

I have this beautiful little code here that will exit from a script if there's another instance of it running: single_instance(){ if pidof -x "${0##*/}" -o %PPID >/dev/null; then exit ...
4
votes
1answer
114 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
2answers
7k views

What does aux mean in `ps aux`?

ps aux seems to conveniently list all processes and their status and resource usage (Linux/BSD/MacOS), however I cannot comprehend the meaning of parameter aux using man ps. What does aux mean?
4
votes
3answers
4k 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
3answers
216 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 ...
4
votes
2answers
362 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
78 views

PS: what does “ps -o comm= -p $PPID” do

I have a script which does ps -o comm= -p $PPID. The explanation says this gets the parent process name. From the man page I found out -o means user defined format, comm means command and -p means ...
4
votes
1answer
114 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
748 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
3k 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
923 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
1answer
4k views

Linux : See CPU usage by a process for the last second

vmstat 1 Above will print virtual memory statistics each seconds. It will also show the CPU utilization for last second. I have a web server at hand which runs httpd and MySQL. I need to find how ...
4
votes
3answers
791 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
846 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
1answer
196 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
2k views

Mathematical connection between SZ RSS and VSZ in ps o/p?

I wanted to know what mathematical connection is there between the SZ, RSZ and VSZ output in ps output e.g. ps -p 2363 -o sz,rss,vsz
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
122 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 ...