ps is a command for printing information about running processes

learn more… | top users | synonyms

4
votes
1answer
7k 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 ...
5
votes
1answer
5k 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 ...
3
votes
1answer
48 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?
7
votes
1answer
624 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?
3
votes
4answers
810 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 ...
5
votes
1answer
3k 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 ? ...
0
votes
2answers
8k views

Please explain this output of ps -ef command?

A part of the output from the ps -ef command is given below : UID PID PPID C STIME TTY TIME CMD root 1 0 0 2012 ? 00:00:01 init [3] root 2 ...
1
vote
3answers
6k views

What is the difference between ps and top command?

What is the difference between ps and top command ? I see that both can display information about running processes . Which one should be used when ?
16
votes
2answers
3k 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 ...
0
votes
0answers
36 views

How can I see a process' thread count? [duplicate]

Possible Duplicate: Is there a way to see details of all the threads that a process has in Linux? I want to see the thread count which belongs to a process in linux. What command should I ...
0
votes
0answers
331 views

Very large values for utime and stime for foo. Is foo still running?

I am running a program foo It has been running for close to 30 days now (even more) Until around 10 days ago (I cannot be very exact) it used 100% of one cpu on my dual core laptop (it was at the ...
2
votes
1answer
102 views

“ps” output and comments

I'm pretty sure you cant do this but maybe someone has some weird hack... Is there a way to get comments (#blahblah) to show up in ps output? My problem is that i have a script, lets call it ...
12
votes
2answers
13k 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 ...
8
votes
2answers
226 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 ...
1
vote
3answers
1k views

I want to kill all processes that result from the following command

The following command will display all the PID's running for vmstat1: ps -ef | grep "vmstat 1" | awk '{ print $2 }' My question is, how do I kill them all, if there's like 20 of them at once?
1
vote
2answers
178 views

receiving command as a parameter in bash

I have a following simple script called single-instance that executes the given command if there is no process under that command running. If I hard-code the command after the else statement, it has ...
1
vote
1answer
258 views

Linux + Solaris how to verify the last execute process from list of process

I need advice: How to verify which is the last scan_sys.sh process that run in my linux or solaris ? my target is to kill all scan_sys.sh process , except the latest scan_sys.sh ( the last execute ...
2
votes
0answers
356 views

PS command ouput limited to 80 bytes only [duplicate]

Possible Duplicate: How can I get a full process list in solaris, without truncated lines? The output of ps command only returns 80 bytes. Below is the text from manual pages of Solaris ps ...
3
votes
1answer
5k 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 ...
1
vote
1answer
760 views

Bafflingly baroque Debian ps: show threads in forest tree

My favourite ps invocation is: ps -efww ef as I need to watch all processes (-e), get extended information about them (-f), see the environment (e) they operate within, wrapping lines (-w -w) so I ...
3
votes
0answers
151 views

Can I get WCHAN from ps on Mac OS X 10.7.4?

From the manual it seems that ps -AO wchan should tell me what everything is sleeping on, but everything comes up as -. (And nwchan as 0). Did they do away with the old sleep()/tsleep() interface in ...
1
vote
2answers
1k views

Where to find the source code for ps?

I want to check out the source code for commands such as ps. It seems to be impossible to search LXR (linux.no) for "ps". Where do I find it?
1
vote
1answer
76 views

PS tags does not work

I run a ps command inside a startup script, if I put in: ps -A -o euser,pid... I get this output: EUSER PID CMD %CPU RSS SZ ELAPSED root 644 ./code ...
0
votes
2answers
214 views

Total RAM used by a program with `ps`? [duplicate]

Possible Duplicate: Measuring RAM usage of a program I am trying to use ps to benchmark a program, I'm just not sure which flags to use. I would like to get the amount of RAM the program ...
4
votes
1answer
2k 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 ...
2
votes
2answers
165 views

Print like Firefox

Made a CLI script to print Wikipedia articles: WIKI='https://en.wikipedia.org/w/index.php?title=' TITLE=$1 PRINTABLE='&printable=yes' SRC=$WIKI$TITLE$PRINTABLE HTML=$1".html" PS=$1".ps" wget ...
41
votes
4answers
4k 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 ...
0
votes
1answer
1k views

The TIME field in ps -ef

When I do ps -ef, I see "TIME" field. What does this field mean? From what I understand, this tells the actual CPU time, that the process got (amidst all the context switching). Does the TIME field ...
4
votes
1answer
125 views

Get process list with logical intersection of selectors?

The Linux ps command allows multiple selectors, such as user and command name, but always returns the logical OR of those selectors (more than I want). Does anyone know of a method or tool already ...
4
votes
1answer
3k 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
2
votes
1answer
8k views

Among “ps” command output fields, %CPU isn't the actual CPU usage of the process?

For example, one of the output fields of this BSD style command, ps aux, is "%CPU". The alternative command, ps -efl outputs the "C" (or CP) field. As per the ps man page: %CPU is the cpu ...
7
votes
3answers
3k 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
4answers
5k 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 . ...
1
vote
3answers
5k views

Why is apache2 showing up a defunct in the process list?

When I run top I see one line that doesn't look too good: 2475 www-data 20 0 0 0 0 Z 1 0.0 0:00.19 apache2 <defunct> Why is this process <defunct> and what should I ...
4
votes
2answers
444 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 ...
1
vote
4answers
913 views

Call 'ps' as a normal user in Linux

A brief introduction to my question: the command ps will print the information of system processes. But when I login as root and change the permission x of ps chmod -x /bin/ps chmod u+x /bin/ps ls ...
1
vote
6answers
5k views

How do use awk along with a command to show the process ID with the 'ps' command

I'm able to to show the PID (2nd) column with the below command, but instead I want to show pwdx <PID> and also the COMMAND(8th) column. Thanks in advance, Chirag ps -ef | grep runner | awk ...
4
votes
3answers
986 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 ...
3
votes
1answer
356 views

HP-UX SZ limit for ps?

Right so I have a fun little thing that I'm deathly confuzzled about. I have a program that is running and I am getting the following: using top: SIZE RES 1639M 359M using ps: SZ 20171 ...
26
votes
2answers
10k 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 ...
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 ...
3
votes
2answers
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?
7
votes
4answers
4k 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 ...
3
votes
4answers
1k 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.
6
votes
2answers
972 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 ...
2
votes
4answers
4k views

Alternative to `pkill` or `pgrep -f` on cygwin?

Suppose I have starting my process like: java -DSOME_STRING -jar foo.jar Then on linux, I can use the following to find or kill this process: pgrep -f SOME_STRING pkill -f SOME_STRING However ...
12
votes
2answers
731 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 ...
10
votes
1answer
12k 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+'?
9
votes
1answer
5k 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 ...
28
votes
3answers
11k views

What are “session leaders” in `ps`?

What are session leaders, as in ps -d which selects all processes except session leaders?