Operations 6 min read

Master Linux System Services: List, Check, and Manage with systemd & netstat

This guide explains how to list all running Linux services, inspect their status, and examine service configurations using systemd commands, netstat, and the /etc/services file on CentOS/RHEL and older SysV init systems.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux System Services: List, Check, and Manage with systemd & netstat

Linux system services (daemons) start automatically at boot and stop on shutdown. This article shows how to list all running services and check their status on CentOS/RHEL 7.x and older SysV init systems using systemd, netstat, and the /etc/services file.

Viewing systemd services on CentOS/RHEL 7.x

CentOS 7 uses systemd, replacing traditional daemon commands with systemctl. To list unit files:

systemctl list-unit-files

To list all active services:

systemctl | more

To list only services:

systemctl list-units --type service

You can pipe the output to grep to search for a specific service, e.g.:

systemctl | grep "apache2"

Using netstat to view services and listening ports

The netstat command displays active network connections, interface statistics, and routing tables. To show services and their listening ports:

netstat -pnltu

Inspecting the /etc/services file

The file /etc/services is an ASCII list of service names, port numbers, protocols, and aliases. You can view it with any text editor, for example:

vim /etc/services

Checking the status of a specific systemd service

Use systemctl status <service_name> to see detailed status. Example for OpenSSH:

systemctl status sshd

To test whether a service is active:

systemctl is-active sshd

To check if a service is enabled at boot:

systemctl is-enabled sshd

Viewing service status on older SysV init systems

On systems still using SysV init, the service command reports status. Example for OpenSSH:

service sshd status

To list all services and their statuses, you can use:

chkconfig --list
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

command-lineSysadminsystem servicesnetstatsystemd
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.