The ps command (a.k.a process status) provides a snapshot of the current processes running on the system.
For repetitive updating of the process information (e.g. updates on how much CPU and memory each process is using, similar to Task Manager in Windows) see the top command instead.
By default, ps only prints processes owned by the current user, AND are processes that are associated with the terminal that called
ps. Normally this will result in quite a small amount of output, perhaps only 2-5 processes.
You will always be guaranteed these two above when running from a bash terminal, obviously bash is running, and so is the ps command (it includes itself).
More Complete Information
More complete information on the running processes of the system can be found by providing arguments, such as the UNIX-style
If you want more detail on the command that started each process, use
PID is the process ID and
PPID is the parent process ID.
If you use BSD style options (no dash),
ps will print the command and the provided options for each process, rather than the executable name:
This is only a snapshot of the total number of processes it will print!
ps can support a large and confusing amount of different option styles, including UNIX options (one dash), BSD options (no dash) and GNU long options (two dashes).
ps With grep
The output of
ps can be piped to
grep to filter the results. For example, if you wanted to only look for processes with the word
hocus_pocus in it:
Note: grep will match anything on the line printed by
ps -aux. That means that
hocus_pocus will be matched against the username column and any paths in the process name.
However, aside from having to use two commands, there are other disadvantages to using
grep. A completely new program,
pgrep was built to try and provide a better process-searching tool.
This work is licensed under a Creative Commons Attribution 4.0 International License .