ps is a command for printing information about running processes

learn more… | top users | synonyms

2
votes
1answer
5k views

ps switches to display PID, PPID, PGID, and SID collectively

I tried ps with different kinds of switches e.g. -A, aux, ef, and so forth but I cannot seem to find the right combination of switches that will tell me the Process ID (PID), Parent Process ID (PPID), ...
2
votes
2answers
98 views

How can I automate this manual task of finding a particular ancestor process from a given pid or command?

I know the full command "/bin/child_process" or its pid (3996 in this case) and I'm running ps auxf and then visually identifying its ancestor process /bin/parent_process foobar. root 3227 0.0 ...
1
vote
1answer
151 views

difference between bash, -bash and /bin/bash in ps output [duplicate]

Someone had spawned a while true loop in bash (logged in as root) on a server. It kept spawning processes, which fortunately exited but I needed to kill the parent. I came to know it was spawned ...
1
vote
2answers
507 views

“ps” command doesn't return to prompt

I have this linux box that I need to maintain periodically. To do that, I issue a ps command programmatically and check the running processes. But as shown in the screenshot, sometimes, the ps ...
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 ...
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 ...
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 ...
2
votes
1answer
371 views

UNIX-, BSD-, GNU-options in Linux's ps command. Where are they from? [closed]

In the manual for the ps command on Ubuntu there is this text: This version of ps accepts several kinds of options: 1 UNIX options, which may be grouped and must be preceded by a ...
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...
1
vote
1answer
160 views

AIX why does ps display the process name between square brackets? [duplicate]

On AIX 7 I have a process whose name appears between square brackets in the ps output: PID TTY TIME CMD 7798784 pts/2 0:00 [myproc] 9044154 pts/2 0:00 ps 10485770 pts/2 0:00 ...
0
votes
2answers
84 views

Why the -u flag doesn't work for ps?

I'm executing the following ps command: root@dor-desktop:/home/dor# ps u -t "$(tty)" -u mysql USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND dor 2070 0.0 0.1 22436 ...
4
votes
2answers
921 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 ...
0
votes
2answers
1k views

`ps | grep | kill` aborts my script prematurely [duplicate]

I have a Linux computer that I remotely SSH into using plink on a Windows XP machine. I have the Plink program set to execute commands in a script using automated login: plink -ssh [domain name] -l ...
0
votes
1answer
273 views

What is the meaning of “\_” in output of 'ps ef'?

When I executed ps ef command in a linux server, I saw that one of the command starts with \_. For example, \_ /bin/sh /usr/ Could any one please let me know what is the meaning of \_ in this ...
1
vote
2answers
161 views

How to make sure the shell builtin echo is invoked so that its not visible in process list?

Is this going to be visible in the process listing if the below line is executed from a command line or a shell script bash -c "echo $password" or i just need to do echo $password from within ...
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 ...
1
vote
1answer
568 views

'ps' command hangs

A coworker ran into this issue twice and I don't know what's wrong. His ps command hangs, taking about 25% of the CPU. in_progress=1 sleep 10 while [ "$in_progress" -eq 1 ]; do ...
4
votes
3answers
783 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 ...
1
vote
2answers
794 views

How to watch pgrep?

When running a pgrep command with watch it does not only show the actual pgrep output, but also the watch process as well. Example: watch pgrep -lf donothing will show 3 processes, although ...
0
votes
1answer
386 views

ps | grep shows bad output in subshell with jobs running in the background

I am using bash. I have a file named "a2draw" that contains only 1 line: sleep 99999 I start it using this command: bash a2draw & Now, I know and understand the trick with square bracket ...
2
votes
1answer
1k views

What does a “[1]+ Exit 1” response mean?

I ran this command to try and get my python program to run in the background and let me exit the SSH connection I am using: nohup python files.py >> files.log & I then check ps to check ...
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 ...
1
vote
1answer
181 views

Convert ps to pdf by ps2pdf, but the pdf file is not well-behaved

I have a ps file,and converted it to a pdf file using ps2pdf. ps2pdf elden.ps elden.pdf When I open the pdf file in evince, and try to select some text in it using my mouse, the selected content ...
7
votes
3answers
915 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]/ ...
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
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 ...
3
votes
1answer
45 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
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?
3
votes
4answers
518 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
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 ? ...
-1
votes
2answers
3k 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 ...
0
votes
3answers
4k 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 ?
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 ...
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
233 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
96 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 ...
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 ...
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 ...
1
vote
3answers
812 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
169 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
190 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
3k 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
574 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
139 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
960 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
75 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
198 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
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 ...
2
votes
2answers
138 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 ...