Linux - ps (process statut)

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

1 - About

Report a snapshot of the current processes.

To get a repetitive update of the selection and of the displayed information, use top.

This ps works by reading the virtual files in /proc.

Advertising

3 - Management

3.1 - tree

To print a process tree:

ps -ejH
ps axjf

3.2 - thread

3.3 - user process

ps -u oracle -f
UID        PID  PPID  C STIME TTY          TIME CMD
oracle   13502 13499  1 14:09 ?        00:01:09 sshd: [email protected]/2
oracle   13503 13502  0 14:09 pts/2    00:00:00 -bash
oracle   16382 16380  0 14:44 ?        00:00:00 sshd: [email protected]
oracle   16383 16382  0 14:44 ?        00:00:00 /usr/libexec/openssh/sftp-server
oracle   16430 16415  0 14:44 ?        00:00:00 sshd: [email protected]
oracle   16431 16430  0 14:44 ?        00:00:00 -bash
oracle   17442     1  0 14:59 ?        00:00:01 /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inh
oracle   29107 13503  0 15:39 pts/2    00:00:00 man ps
oracle   29110 29107  0 15:39 pts/2    00:00:00 sh -c (cd /usr/share/man && (echo ".ll 9.8i"; echo ".nr LL 9.
oracle   29111 29110  0 15:39 pts/2    00:00:00 sh -c (cd /usr/share/man && (echo ".ll 9.8i"; echo ".nr LL 9.
oracle   29116 29111  0 15:39 pts/2    00:00:00 /usr/bin/less -is
oracle   29224 13503  0 15:42 pts/2    00:00:00 ps -u oracle -f
  • Sort
ps -ao pid,user,args --sort user

3.4 - full output

ps -ef | grep <process>

where the flag:

  • -e selects every process
  • -f chooses the “full” output format
Advertising

3.5 - full with parameters

For complete information about the process including all parameters

ps auxww | grep <process>

where:

  • a lists all processes on a terminal, including those of other users,
  • x lists all processes without controlling terminals
  • u adds a column for the controlling user for each process.
lang/bash/ps.txt · Last modified: 2018/12/19 20:31 by gerardnico