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ón | Significado |
|---|---|
| status <unit> | Whether it is running, its PID, and the last log lines. |
| start / stop / restart | Act on the service now, without changing boot behaviour. |
| reload | Re-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-reload | Required after you edit a .service file, before restarting it. |
| list-units --failed | Everything that failed to start. |
| --user | Act on your own user units instead of the system ones. |
Ejemplos
sudo systemctl restart nginxRestart the web server.
systemctl status sshd --no-pagerPrint the state and recent log lines without opening a pager.
sudo systemctl enable --now dockerStart 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