How to manage Linux services using Systemd
One of the most important skills that any new Systemd user needs to learn is how to manage computer services. This article will teach you the basics: start, stop, enable and disable services from the Linux command line.
What is Systemd?
There are a number of Linux computers running Systemd such as in the Linux, Debian, Fedora, Red Hat and Ubuntu distributions that use Systemd by default. Some distributions will be difficult or impossible to run without installing Systemd.
- 10 Linux distributions you may not know yet
Systemd was designed to replace SysV's old init project, which has been used in UNIX distributions since the 1980s. Lennart Poettering's main developer has also stated that Systemd can do more tasks. init and can act as a development platform and link between individual applications, the Linux kernel.
How to start and stop units
Systemd starts, stops, turns on and turns off "unit". Units include services, mount points, devices and sockets on the computer. In these instructions, you will work with services (.service files), which represent programs on the computer waiting for access for a specific task.
Some Linux distributions have access to Hddtemp, a small utility that checks the temperature of the hard drive. Hddtemp has a .service file and can run as a daemon, so you can start it manually and allow it to activate at startup. This utility is small so you can download and try it with Systemd, you can delete it later if you want.
- Instructions for checking the temperature of CPU, VGA, hard drive of computer, laptop
Install Hddtemp on Arch with the following command:
sudo pacman -S hddtemp
and on Ubuntu with:
sudo apt-get install hddtemp
Now start the new utility with Systemd:
sudo systemctl start hddtemp.service
You can then restart, stop and see the status of man-db with the same type of systemctl unit. Notice that the 'unit' works like any 'unit.service' file that you will use.
sudo systemctl start hddtemp
commands, sudo systemctl stop hddtemp
, and sudo systemctl restart hddtemp
does not create output by default when it runs successfully.
You can get more service information with the following command:
sudo systemctl status hddtemp
In this case, this command will provide the name of the service, the status of the service (active or inactive) and start / stop made in minutes. If any of the above commands fails or causes an error, those problems will show up in the status report.
Activate and deactivate units
When starting or stopping a unit, you are completing a manual process that will likely only last for the current session. When restarting, the unit you start may not run automatically.
For units to boot, try turning them on with Hddtemp:
sudo systemctl enable hddtemp
The output will show that Systemd has created a symbolic link (symlink) to start Hddtemp automatically when the computer is in the boot process. The next time you can use the shortcut:
sudo systemctl enable --now unit
to activate and start a unit in a command.
You can now disable Hddtemp easily with the following command:
sudo systemctl disable hddtemp
If you are unsure whether a unit is enabled, you can run the sudo systemctl is-enabled unit command.
Now you can remove Hddtemp from your computer if you want.
When using Systemd, the above commands will become useful when managing programs on the computer. Check the 'COMMANDS' section of the Systemctl man page with the command man systemctl to see the commands that start, stop, enable, disable, and other commands are more complex than the example above, but you should not worry about the commands. This command is very easy to use.
See more:
- How to manage Windows Vista services
- Disable unnecessary services in Windows 7
- All ways to open Windows Services on Windows 10/8/7
You should read it
- Basic Linux commands everyone needs to know
- The Linux machine can be remotely hacked with a poisoned DNS response
- How to use the which command in Linux
- How to use the last command in Linux
- How to check whether a Linux PC is 64-bit or 32-bit by command line
- 12 things Linux is easier to do in the command line than graphical software
- How to check internet speed with the command line in Linux
- How to use the Linux command line on Android with Termux
May be interested
- 8 commands for efficient management of Linux processesthere are three main states in the life cycle of an application process: start, run, and stop. if you want to be a competent linux administrator, you need to know how to manage each state carefully. the following 8 commands can be used to help you manage the entire process lifecycle.
- How to manage memory to restrict Linux to use too much RAMyou install linux with the promise that it will consume less system resources than windows. but why then, is your system still slow?
- Is Linux, Windows or macOS the operating system for you?an operating system is simply defined as software that allows you to manage your computer's hardware and resources, and provides a number of common services that allow you to run different programs.
- How to modify and manage Hosts files on Linuxif you need to block web pages or create personalized web shortcuts on linux, solve these tasks by adding or adjusting a few lines in the hosts file.
- How to manage packages on RPM-based Linux distributions with DNFthis tutorial will show you how to install and manage software packages on rpm-based linux distributions like fedora and red hat enterprise linux (rhel) using dnf.
- How to Install and Use Fonts in Linuxbut while font rendering is far from perfect in linux, one thing this open source platform does well is allow users to easily manage their fonts. from selecting, adding, and adjusting, you can work with fonts quite easily in linux.
- How to find, set and change IP addresses on Linuxip address is like a computer phone number. computers use it to communicate with other devices and vice versa. here are some simple ways to manage ip addresses on linux.
- Linux is everywherequietly, but at a very fast pace, linux is penetrating increasingly into consumer services, devices and products, from email to cars. a revolution called linux is quietly embracing consumer technology.
- Guide to network operation for Linux users: 11 commands to knowlinux supports commands to download files, diagnose network problems, manage network interfaces or view network statistics on the terminal. here are some common linux commands to work with, please consult.
- How to manage user passwords from Terminal in Linuxlike many things on linux, passwords are easily managed directly from the command line. the passwd utility is designed to allow you to quickly and easily access all password-related commands on the system. you can use it to change and manage your password and other user passwords on the system