ps is a command for printing information about running processes
0
votes
2answers
38 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
63 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
56 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 ...
44
votes
8answers
2k 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
63 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
75 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
1answer
58 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
102 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
90 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
110 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
76 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 ...
3
votes
0answers
78 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]/ ...
2
votes
1answer
213 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
77 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
25 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?
6
votes
1answer
238 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?
2
votes
4answers
73 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 ...
4
votes
1answer
217 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 ? ...
-3
votes
2answers
354 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
252 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 ?
12
votes
2answers
265 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
26 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
97 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
80 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 ...
2
votes
2answers
872 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
159 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
177 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?
0
votes
2answers
133 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
126 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
1answer
257 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
863 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
211 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
97 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
379 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
59 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
150 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
484 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
101 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 ...
24
votes
2answers
1k 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
378 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 ...
3
votes
1answer
83 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 ...
2
votes
1answer
1k 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
4k 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 ...
5
votes
2answers
652 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?
5
votes
4answers
1k 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
2k 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
173 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
452 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 ...
0
votes
6answers
1k 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 ...
3
votes
3answers
220 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 ...

