ps is a command for printing information about running processes

learn more… | top users | synonyms

1
vote
1answer
979 views

Difference between top and ps output

I have seen What is the difference between ps and top command? but I think my question is unrelated. My system is Lubuntu 13.04. I run top in one lxterminal window and ps -eo %c%C --sort -%cpu | head ...
4
votes
3answers
1k views

ps: full command is too long

Good day! I use 'ps' to see command that starts process. The issue is that command is too long and 'ps' does not show it entirely. Example: I use command 'ps -p 2755 | less' and have following ...
0
votes
3answers
136 views

ps output differs when run from command line and from script

I have to create list of PID's of the running processes. Here is the script ps echo "fields are " ps | cut -d' ' -f1 ps is showing PID TTY TIME CMD 2168 pts/4 00:00:00 sh 2177 ...
3
votes
1answer
165 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 ...
9
votes
2answers
2k 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 ...
2
votes
3answers
2k views

How is it possible to sort ps command's CPU field?

I'm trying to make a small command that will find the processes that use the most CPU power. Firstly, I use ps aux > file.txt and then cut -c 16-20 file.txt | sort -n | tail -5. The result I get ...
2
votes
1answer
790 views

What is the meaning of ps process names printed in [] such as [cgroup]? [duplicate]

when I do a command such as ps -aux on CentOS 6 I get a bunch of processes whos command is listed in [] as shown below. What is the meaning of the [] in the name? I am assuming that these are special ...
3
votes
2answers
321 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
2answers
479 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 ...
2
votes
1answer
2k views

How to see process created by specific user in Unix/linux

I want to see list of process created by specific user or group of user in Linux Can I do it using ps command or is there any other command to achieve this?
4
votes
3answers
293 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
8k 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
110 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
186 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
713 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 ...
5
votes
1answer
235 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
7k 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
131 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
424 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
3k 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
198 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
91 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
1k 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
317 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
182 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 ...
70
votes
8answers
10k 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
684 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
979 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
964 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
459 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
2k 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
128 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
220 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 ...
8
votes
3answers
1k 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
5k 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
4k 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
46 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
556 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
681 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 ? ...
-1
votes
2answers
6k 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
5k 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
2k 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
294 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
98 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 ...
9
votes
2answers
10k 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
223 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?