Mini systemd command cheat-sheet
These are the most common commands I use if my systemd service file is placed in /etc/systemd/system/myservice.service
.
Enable (i.e. start at boot) and also start the service right now (--now
):
example.sh
sudo systemctl enable --now myservice
Start by
example.sh
sudo systemctl start myservice
Restart by
example.sh
sudo systemctl restart myservice
Stop by
example.sh
sudo systemctl stop myservice
View status:
example.sh
sudo systemctl status myservice
View & follow logs:
example.sh
sudo journalctl -xfu myservice
View logs in less
:
example.sh
sudo journalctl -xu myservice
Check out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow