Inicio·Comandos de terminal

systemctl

Procesos y sistema

Uso

systemctl <verb> <unit>

Arranca, detiene e inspecciona servicios de systemd; `enable` solo fija el arranque, asi que usa `enable --now` para iniciarlo tambien, y ejecuta `daemon-reload` tras editar un unit.

Opciones habituales

OpciónSignificado
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.

Ejemplos

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.

Qué se está ejecutando y qué se come la máquina. Identificarlo va antes de matarlo.

Cómo leerlo

  • Los corchetes [ ] marcan una parte que puedes omitir.
  • Los puntos suspensivos … indican que puedes poner varios.
  • Las opciones distinguen mayúsculas: en algunos comandos -r y -R no hacen lo mismo.

Preguntas

Q. ¿Qué hace systemctl?

Arranca, detiene e inspecciona servicios de systemd; `enable` solo fija el arranque, asi que usa `enable --now` para iniciarlo tambien, y ejecuta `daemon-reload` tras editar un unit.

Q. ¿Cómo se escribe?

systemctl <verb> <unit> — los corchetes marcan lo que puedes omitir.

Q. ¿Cuántas opciones vale la pena saber?

Aquí van 7; la lista completa está en man systemctl. Este comando está en Procesos y sistema.

Comandos relacionados

página man: man systemctl