ps
Prozesse und System
Aufruf
ps aux | ps -efZeigt eine Momentaufnahme der laufenden Prozesse; `ps aux` ist die BSD-Form ohne Bindestrich, `ps -ef` die POSIX-Form, und beide zu mischen ist der typische Fehler.
Häufige Optionen
| Option | Bedeutung |
|---|---|
| aux | BSD form (no dash): every process of every user, including those with no terminal. Works on Linux and macOS. |
| -ef | POSIX form: the same list with the parent PID and the full command line. |
| -p <pid> | Show one process only. |
| -u <user> | Only the processes of that user. |
| -o pid,ppid,%cpu,%mem,comm | Choose exactly which columns to print. |
| --sort=-%cpu | Sort by CPU, highest first. GNU procps only; macOS ps has no --sort. |
Beispiele
ps aux | grep -i nginxFind the nginx processes and their PIDs.
ps -eo pid,%mem,comm --sort=-%mem | headThe ten processes using the most memory (Linux).
ps -p 1234 -o etime=How long PID 1234 has been running, with no header.
Was läuft und was die Maschine frisst. Erst herausfinden, was es ist, dann beenden.
So liest man das
- Eckige Klammern [ ] markieren einen Teil, den man weglassen kann.
- Drei Punkte … heißen: mehrere sind erlaubt.
- Optionen achten auf Groß- und Kleinschreibung — bei manchen Befehlen sind -r und -R verschieden.
Häufige Fragen
Q. Was macht ps?
Zeigt eine Momentaufnahme der laufenden Prozesse; `ps aux` ist die BSD-Form ohne Bindestrich, `ps -ef` die POSIX-Form, und beide zu mischen ist der typische Fehler.
Q. Wie gibt man ihn ein?
ps aux | ps -ef — eckige Klammern markieren, was wegfallen darf.
Q. Wie viele Optionen lohnen sich?
Hier stehen 6; die vollständige Liste steht in man ps. Der Befehl gehört zu Prozesse und System.
Verwandte Befehle
man-Seite: man ps