On Linux systems that come with systemd, the systemctl command is pretty much a universal command that does many things for you. In addition to controlling your system's services, it can also show you the status of those services. We have the following code:
donnie@linux-0ro8:~> sudo systemctl -t service --state=active
Here's the breakdown of the preceding command:
- -t service: We want to view information about the services—or, what used to be called daemons—on the system
- --state=active: This specifies that we want to view information about all the system services that are actually running
A partial output of this command looks something like this:
UNIT LOAD ACTIVE SUB DESCRIPTION
accounts-daemon.service loaded active running Accounts Service
after-local.service loaded active exited /etc/init.d/after.local Compatibility
alsa-restore.service loaded active exited Save/Restore Sound Card State
apparmor.service loaded active exited Load AppArmor profiles
auditd.service loaded active running Security Auditing Service
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
cron.service loaded active running Command Scheduler
. . .
. . .
systemd-sysctl.service loaded active exited Apply Kernel Variables
systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev
systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories
systemd-udev-root-symlink.service loaded active exited Rule generator for /dev/root symlink
systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
systemd-udevd.service loaded active running udev Kernel Device Manager
systemd-update-utmp.service loaded active exited Update UTMP about System Boot/Shutdown
You generally won't want to see quite this much information, although you might at times. This command shows the status of every service that's running on your system. What really interests us now is just the network services that can allow someone to connect to your system. So, let's look at how to narrow things down a bit.