SystemD linux terminal commands

  • sudo systemctl is-enabled service.service

Checks whether the service is enabled or not

  • sudo systemctl enable service.service

enables the service to auto-start at boot time

  • sudo systemctl disable service.service

disables the service with name service for auto-start at boot time.

  • sudo systemctl daemon-reload

Reloads the systemctl unit files. This command should be executed after any change in unit files are made

  • sudo systemctl restart service.service

Restarts the service named service

  • sudo systemctl status service.service

Gets the current status of the service named service

  • sudo touch filename.service

create a text file

  • sudo cp filename newfilename

Make a copy of the file

  • sudo nano filename

open a file

  • shutdown -r now

Restarts the ubuntu server from the command line

  • ps -ef | grep service

Get the process id for the service with the name service

  • sudo kill -9 process_number

kills the process with process id “process_number”

  • cd /etc/systemd/system

change the current directory to the directory where all the unit files are located

  • sudo systemctl edit service.service

Edits the unit file for service.service

  • an Example of Unit file for a java process



Description=nearbyshops_sds: Nearbyshops Service Discovery Service


ExecStart=/usr/lib/jvm/java-8-openjdk-amd64/bin/java -cp /nearbyshops/sds/sds_api_2feb17.jar org.nearbyshops.sds.Main





Links and References

Link :

An Example of a unit file

Link :

An Example of how to create a unit file from scratch

Link :