Início·Comandos de terminal

systemctl

Processos e sistema

Uso

systemctl <verb> <unit>

Inicia, para e inspeciona servicos do systemd; `enable` so define o comportamento no boot, entao use `enable --now` para iniciar tambem, e rode `daemon-reload` depois de editar um unit.

Opções comuns

OpçãoSignificado
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.

Exemplos

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.

O que está rodando e o que está comendo a máquina. Identificar vem antes de matar.

Como ler

  • Os colchetes [ ] marcam uma parte que você pode omitir.
  • As reticências … indicam que você pode listar vários.
  • As opções diferenciam maiúsculas: em alguns comandos -r e -R fazem coisas diferentes.

Perguntas

Q. O que systemctl faz?

Inicia, para e inspeciona servicos do systemd; `enable` so define o comportamento no boot, entao use `enable --now` para iniciar tambem, e rode `daemon-reload` depois de editar um unit.

Q. Como se digita?

systemctl <verb> <unit> — os colchetes marcam o que você pode omitir.

Q. Quantas opções vale a pena saber?

Aqui estão 7; a lista completa está em man systemctl. Este comando fica em Processos e sistema.

Comandos relacionados

página man: man systemctl