Qu'est-ce qu'un processus ?
Un processus est un programme en execution avec un PID unique.
Etats
- R (Running) — En execution
- S (Sleeping) — En attente
- T (Stopped) — Suspendu
- Z (Zombie) — Termine, pas nettoye
Lister les processus
ps # Processus courants
ps aux # Tous les processus
ps aux | grep nginx # Filtrer
ps auxf # Arbre
Surveillance temps reel
top # Moniteur integre (q=quitter, k=kill, M=memoire, P=CPU)
htop # Version amelioree
Gerer les processus
pgrep nginx # Trouver le PID
pgrep -l nginx # Avec le nom
kill 1234 # SIGTERM (arret propre)
kill -9 1234 # SIGKILL (arret force)
killall nginx # Par nom
sleep 100 & # Lancer en arriere-plan
jobs # Voir les jobs
fg %1 # Premier plan
nice -n 10 commande # Priorite basse
Conseil : Utilisez
kill (SIGTERM) avant kill -9 (SIGKILL).