Tag Info

Hot answers tagged


The correct syntax, which returns the same output, would be: ps u There is a good reason why modern syntax for ps is a mess. Historically, there were two incompatible version of ps. Options with a leading dash were inherited from the AT&T Unix version of ps. Options without a leading dash were inherited from BSD. The version of ps that Linux ...


$ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND timothy 29217 0.0 0.0 11916 4560 pts/21 S+ 08:15 0:00 pine root 29505 0.0 0.0 38196 2728 ? Ss Mar07 0:00 sshd: can [priv] can 29529 0.0 0.0 38332 1904 ? S Mar07 0:00 sshd: can@notty USER = user owning the process PID = ...


The ps command historically had wildly different syntax in BSD and System V Unix. In BSD ps, the u option (no dash) takes no parameter and shows the "user-oriented output" with the additional columns. In SunOS ps, the -u option (with dash) takes a username as parameter and only includes processes owned by that user, but without changing the display format. ...


% sudo ls -l /proc/PID/exe eg: % ps -auxwe | grep 24466 root 24466 0.0 0.0 1476 280 ? S 2009 0:00 supervise sshd % sudo ls -l /proc/24466/exe lrwxrwxrwx 1 root root 0 Feb 1 18:05 /proc/24466/exe -> /package/admin/daemontools-0.76/command/supervise


grep's -v switch reverses the result, excluding it from the queue. So make it like: ps aux | grep daemon_name | grep -v "grep daemon_name" | awk "{ print \$2 }" Upd. You can also use -C switch to specify command name like so: ps -C daemon_name -o pid= The latter -o determines which columns of the information you want in the listing. pid lists only the ...


This can happen if the username is longer than 8 characters.


pstree ${pid} where ${pid} is the pid of the parent process. On gentoo pstree is in the package "psmisc," apparently located at http://psmisc.sourceforge.net/


You can use a character class trick. "[d]" does not match "[d]" only "d". ps aux | grep [d]aemon_name | awk "{ print \$2 }" I prefer this to using | grep -v grep.


In Linux the command: ps -aux Means show all processes for all users. You might be wondering what the x means? The x is a specifier that means 'any of the users'. So you could type this: ps -auroot Which displays all the root processes, or ps -auel which displays all the processes from user el. The technobabble in the 'man ps' page is: "ps -aux ...


Try this: ls -l /proc/<PID>/cwd


This should work: ps h --ppid $PID -o pid


From the ps manpage: S Interruptible sleep (waiting for an event to complete) For BSD formats and when the stat keyword is used, additional characters may be displayed: s is a session leader l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)


Avoid parsing ps's output if there are more reliable alternatives. pgrep daemon_name pidof daemon_name


It is normal for Mac OS X. It used to be normal on almost all Unix-oid systems. It runs as root without sudo because the ps binary is set-uid to run as root (e.g. on my 10.4 system): % ls -l $(which ps) -rwsr-xr-x 1 root wheel 31932 Mar 20 2005 /bin/ps (the s in place of the the user-owner x column means that it is set-uid (and user-executable), the ...


The pstree is a very good solution, but it is a little bit reticent. I use ps --forest instead. But not for a PID (-p) because it prints only the specific process, but for the session (-g). It can print out any information ps can print in a fancy ASCII art tree defining the -o option. So my suggestion for this problem: ps --forest -o pid,tty,stat,time,cmd ...


Derived rom HUB's answer: readlink /proc/<PID>/cwd or even readlink /proc/$(pgrep <program_name>)/cwd


I had that happen once when an NFS server went down. The fact that it's hung trying to read information about pid 17398, and pid 17398 is in D (disk wait) state, suggests that could be the cause for you too. read(6, "Name:\tconvert\nState:\tD (disk sle"..., 1023) = 664 open("/proc/17398/cmdline", O_RDONLY) = 6 If you do have NFS mounts, I think the ...


One way is ps -ef


man ps says cputime TIME cumulative CPU time, "[dd-]hh:mm:ss" format. (alias time). So your Java process has been running for 1184018564 CPU days (about 3,243,886 CPU years), OR ... something bad has happened. It is Ubuntu bug #859311 associated with long-running multi-threaded processes.


ps axuwfw This is a combination of several BSD-style options (all of which are in the manual page, man ps): a: include processes from other users x: include processes with no terminal u: show user-oriented information fields w: wide output (132 columns instead of 80) f: "forest": tree view of processes w: even wider output (no limit at all) In other ...


The comm field (also /proc/$pid/comm) is limited by the kernel to 16 bytes total (15 characters + terminating NUL byte). If the system is Linux and you own the process (or are root), you can obtain the executable path by following /proc/$pid/exe using the readlink command. Otherwise, you will have to use the cmd field (aliases args, command). On Linux it's ...


From the ps(1) manpage, STANDARD FORMAT SPECIFIERS section: c C processor utilization. Currently, this is the integer value of the percent usage over the lifetime of the process. (see %cpu).


pwdx $pid This gives you the Current Working Directory of the pid, not its absolute path. usually the which command will tell you which is being invoked from the shell. #>which vlc /usr/bin/vlc


In linux procps, the column labeled "PRI" in ps -l is -o opri. Examining output.c shows half a dozen different priority output types: // "priority" (was -20..20, now -100..39) // "intpri" and "opri" (was 39..79, now -40..99) // "pri_foo" -- match up w/ nice values of sleeping processes (-120..19) // "pri_bar" -- makes RT pri show as negative ...


I guess you are looking for the -o argument: -o format: user-defined format. format is a single argument in the form of a blank-separated or comma-separated list, which offers a way to specify individual output columns. The recognized keywords are described in the STANDARD FORMAT SPECIFIERS section below. Headers may be renamed (ps -o ...


There is PDFjam that brings pdfnup and allows you to do basically the same things as psnup.


Here is my version that runs instantly (because ps executed only once). Works in bash and zsh. pidtree() ( [ -n "$ZSH_VERSION" ] && setopt shwordsplit declare -A CHILDS while read P PP;do CHILDS[$PP]+=" $P" done < <(ps -e -o pid= -o ppid=) walk() { echo $1 for i in ${CHILDS[$1]};do walk ...


You might want to use -w with killall for that: -w, --wait Wait for all killed processes to die. killall checks once per second if any of the killed processes still exist and only returns if none are left. Note that killall may wait forever if the signal was ignored, had no effect, or if the ...


In the above, the ps aux runs first and its output is then redirected to the grep ls command. The grep ls command runs after ps aux. So why can ps know about the process that runs after it and has it in its output? You are writing about a logical order of command sequencing. If you get insights in bash proceedings you get to know that both ...


without the -A, ps will only print the processes belonging to the current session. Think of it like "absolutely everything". On a related note -a does the same thing, but restricting it to the session-owner (username).

Only top voted, non community-wiki answers of a minimum length are eligible