All Articles

Linux Services Cheatsheet

I originally wrote this rough cheatsheet for documentation at work, where I had to deal with different linux flavours’ ways of configuring services / daemons.

These commands may be helpful when you are managing linux servers. Different versions of Ubuntu etc use different types of daemon/service managers.

Upstart

Service configurations are located in /etc/init/.

Enable a service on startup. There are two ways depending on OS.

chkconfig --add <service>

or

update-rc.d <service> default

You can then interact with the service using either initctl or service, again depending on OS. Sometimes both work, sometimes both work but show different services. Fun.

SysVinit (init.d)

Reference.

Service scripts are located in /etc/init.d/. Typically you control these by directly interacting with the script themselves.

Initctl cheatsheet

Show services:

initctl list

Stop a service:

initctl stop <service>

Logs can sometimes be found in /var/log/upstart/<service>

Systemd

Simply put, service configurations are located in /etc/systemd/system/.

Enable a service on startup:

systemctl enable <service>

Interact with a given service.

systemctl start|status|restart|stop <service>

Although service probably also works.

Logs can usually be access via journalctl

journalctl -u <service>

Published Nov 7, 2018

Security Engineer with a dash of software. Originally from Stockholm, now in Berlin. I like to hack things.Â