Managing Services in Linux

Published: (February 22, 2026 at 10:08 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Linux commands reminder

In this lab we’ll use a number of Linux commands that were already explained during Course 3. Here is a quick reminder of what these commands do:

  • sudo – executes a command with administrator rights
  • ls – lists the files in a directory
  • mv – moves or renames a file
  • tail – shows the last lines of a file
  • cat – prints the whole contents of a file
  • grep – filters the text of a file according to a pattern
  • less – lets you browse a file

You can combine these commands using the pipe operator (|). For example:

sudo cat /var/log/syslog | grep error | tail

The command above prints the contents of /var/log/syslog, keeps only the lines that contain “error”, and then shows the last 10 lines of that filtered output.

You can always read the manual page for any command with man.

Tip: While you can copy‑paste the commands, typing them manually helps with understanding and memory.

Listing system services

To view the services installed on the machine, use the service command.

sudo service --status-all

Output example

[ - ]  avahi-daemon
[ - ]  cron
[ - ]  cups
[ - ]  cups-browsed
[ - ]  dbus
[ - ]  exim4
[ ? ]  hwclock.sh
[ - ]  procps
[ + ]  rsyslog
[ - ]  saned
[ + ]  ssh
[ - ]  sudo
[ + ]  udev

Legend

  • + – service is active/running
  • - – service is inactive/stopped
  • ? – unable to determine the service state

Stopping and starting services

Now that we have listed the services, let’s practice stopping and starting one of them. We’ll work with the rsyslog service, which writes system logs to files such as /var/log/syslog, /var/log/kern.log, and /var/log/auth.log.

Check service status

sudo service rsyslog status

Sample output

rsyslogd is running.

The status command shows that the service is loaded, enabled (starts automatically on boot), and currently active.

Generate a test log entry

You can see the service in action with the logger command:

logger This is a test log entry
0 views
Back to Blog

Related posts

Read more »