Technik 1.5 — Linux Grundlagen

Prozesse & Signale

Prozesse anschauen

ps aux               # alle Prozesse, ausführlich
ps aux | grep nginx  # filter
top                  # interaktiv (q zum Beenden)
htop                 # hübschere Variante (apt install htop)
pgrep nginx          # nur PIDs
pidof nginx          # PID des Programms

Prozess beenden — kill & Signale

SignalBedeutungStandard
SIGTERM (15)"Bitte beenden, mach sauber"Ja, default
SIGKILL (9)"Sofort tot, ungefragt"Letzte Ausweg
SIGINT (2)Ctrl+C — InterruptVom Terminal
SIGHUP (1)Hangup — viele Daemons reloaden ConfigReload-Trigger
SIGSTOP / SIGCONTPause / ResumeJob-Control
kill 1234              # SIGTERM senden
kill -9 1234           # SIGKILL (hart)
kill -HUP $(pidof nginx)  # nginx reload
killall firefox        # alle Firefox-Prozesse

Job-Control (Vordergrund/Hintergrund)

./langer-prozess           # läuft im Vordergrund
./langer-prozess &         # im Hintergrund
Ctrl+Z                     # pausieren (Vordergrund-Prozess)
bg                         # in Hintergrund weiter
fg                         # zurück in Vordergrund
jobs                       # aktive Jobs anzeigen
nohup ./script &           # läuft auch nach Logout weiter

systemd-Basics

systemd verwaltet auf modernen Linux-Systemen alle Dienste.

systemctl status nginx
systemctl start/stop/restart nginx
systemctl enable nginx       # bei Boot starten
systemctl disable nginx
journalctl -u nginx -f       # Logs live mitlesen
Zurück zu Technik