Accueil·Commandes du terminal

systemctl

Processus et système

Syntaxe

systemctl <verb> <unit>

Demarre, arrete et inspecte les services systemd ; `enable` ne regle que le demarrage au boot, utilisez donc `enable --now` pour lancer aussi, et lancez `daemon-reload` apres avoir modifie un fichier unit.

Options courantes

OptionSignification
status <unit>Whether it is running, its PID, and the last log lines.
start / stop / restartAct on the service now, without changing boot behaviour.
reloadRe-read the config without dropping connections, if the service supports it.
enable --now <unit>Start it now and also start it at every boot.
daemon-reloadRequired after you edit a .service file, before restarting it.
list-units --failedEverything that failed to start.
--userAct on your own user units instead of the system ones.

Exemples

sudo systemctl restart nginx

Restart the web server.

systemctl status sshd --no-pager

Print the state and recent log lines without opening a pager.

sudo systemctl enable --now docker

Start Docker and make it come back after a reboot.

Ce qui tourne et ce qui mange la machine. Identifier vient avant tuer.

Comment lire

  • Les crochets [ ] marquent une partie facultative.
  • Les points de suspension … signifient qu’on peut en mettre plusieurs.
  • Les options sont sensibles à la casse : sur certaines commandes, -r et -R ne font pas la même chose.

Questions fréquentes

Q. Que fait systemctl ?

Demarre, arrete et inspecte les services systemd ; `enable` ne regle que le demarrage au boot, utilisez donc `enable --now` pour lancer aussi, et lancez `daemon-reload` apres avoir modifie un fichier unit.

Q. Comment l’écrire ?

systemctl <verb> <unit> — les crochets marquent ce qui est facultatif.

Q. Combien d’options valent la peine ?

Il y en a 7 ici ; la liste complète est dans man systemctl. Cette commande relève de Processus et système.

Commandes liées

page man: man systemctl