Check running services on Linux

1. How to tell which init system you're on

ps --pid 1 --no-headers -o comm
  • Output systemd → modern init system.
  • Output init (and /sbin/init is not a symlink to systemd) → legacy SysVinit/Upstart (RHEL/CentOS 6 and older, Ubuntu 14.04 and older).

You can also check:

systemctl --version   # succeeds only if systemd is present

2. Legacy systems (SysVinit / Upstart)

Where init scripts live

  • Debian/Ubuntu-based: /etc/init.d/
  • Red Hat/CentOS-based: /etc/rc.d/init.d/

If you don't know a service's exact name, list the directory:

ls /etc/init.d/
# or
ls /etc/rc.d/init.d/

Names differ by distro for the same software — e.g., Apache is httpd on CentOS/RHEL but apache2 on Ubuntu/Debian.

Check status

sudo service <service-name> status
# example
sudo service httpd status

Start / stop / restart

sudo service <service-name> start
sudo service <service-name> stop
sudo service <service-name> restart

List all services and their state at once (RHEL/CentOS 6 style)

service --status-all

+ = running, - = stopped (this syntax is specific to Debian/Ubuntu's service --status-all; behavior can vary by distro).

If a service fails to start

The command reports the failure and usually shows the reason. A common real example (port conflict):

$ sudo service httpd start
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]

This means another process already holds port 80. Confirm with:

sudo netstat -tulpn | grep :80
# or, on systems without netstat:
sudo ss -tulpn | grep :80

Enable/disable a service at boot (persistence) — legacy systems

sudo chkconfig <service-name> on     # enable at boot (RHEL/CentOS 6)
sudo chkconfig <service-name> off    # disable at boot
sudo chkconfig --list <service-name> # show run-level status

On Debian/Ubuntu legacy systems, the equivalent tools are update-rc.d or sysv-rc-conf (not chkconfig, which is Red Hat-family specific).


3. Modern systems (systemd)

The Rackspace article itself notes that many newer distributions use systemd instead of the legacy service tooling, and that every service <name> <status> command has a direct systemctl equivalent.

Basic command template

systemctl <command> <service-name>

This replaces the old service <service-name> <command> order — note the word order flips.

Check status

systemctl status <service-name>
# example
systemctl status httpd.service
systemctl status sshd.service

status output includes current state (active/inactive/failed), recent log lines, and the process tree — more detail than the legacy service status gave.

Quick active/enabled checks (scriptable, no extra output)

systemctl is-active <service-name>     # active / inactive / failed
systemctl is-enabled <service-name>    # enabled / disabled

Start / stop / restart / reload

sudo systemctl start <service-name>
sudo systemctl stop <service-name>
sudo systemctl restart <service-name>
sudo systemctl reload <service-name>     # reload config without dropping connections, if the service supports it

Example equivalent of the legacy service httpd reload:

sudo systemctl reload httpd

Enable/disable at boot (replaces chkconfig)

sudo systemctl enable <service-name>          # start automatically on future boots
sudo systemctl enable --now <service-name>     # enable AND start immediately in one step
sudo systemctl disable <service-name>         # remove from boot startup

enable creates a symlink into the relevant target's .wants directory (e.g., /etc/systemd/system/multi-user.target.wants/); disable removes it.

Fully block a service (stronger than disable)

sudo systemctl mask <service-name>     # prevents ANY start, manual or automatic
sudo systemctl unmask <service-name>   # reverses mask

Attempting to start a masked service returns Unit is masked.

List all services and their state

systemctl list-units --type=service                 # currently loaded services
systemctl list-units --type=service --all            # include inactive/dead ones
systemctl list-unit-files --type=service              # enabled/disabled state at boot

View logs for a service (systemd's journal replaces plain-text init logs)

journalctl -u <service-name>              # all logs for that unit
journalctl -u <service-name> -f           # follow/tail live
journalctl -u <service-name> --since today

4. Old-to-new command cross-reference

TaskLegacy (SysVinit)Modern (systemd)
Check statusservice <name> statussystemctl status <name>
Startservice <name> startsystemctl start <name>
Stopservice <name> stopsystemctl stop <name>
Restartservice <name> restartsystemctl restart <name>
Reload configservice <name> reloadsystemctl reload <name>
Enable at bootchkconfig <name> onsystemctl enable <name>
Disable at bootchkconfig <name> offsystemctl disable <name>
List all servicesservice --status-allsystemctl list-units --type=service --all
View logscheck flat files under /var/log/journalctl -u <name>
Fully block from starting(not standard)systemctl mask <name>

5. Distro naming differences worth checking before you troubleshoot

SoftwareRHEL/CentOS/Rocky/Alma nameDebian/Ubuntu name
Apachehttpdapache2
MariaDB/MySQLmariadb or mysqldmysql or mariadb
SSH daemonsshdssh

Always confirm the exact unit/service name for your distro/version with ls /etc/init.d/, systemctl list-unit-files, or your package's documentation — names and defaults do shift between major distro releases.


6. Practical troubleshooting flow (works on old and new)

  1. Identify init system (ps --pid 1 -o comm).
  2. Confirm exact service name for your distro.
  3. Check current status (service <name> status or systemctl status <name>).
  4. If not running, attempt start and read the failure reason directly from the output.
  5. If a port conflict is reported, cross-check with ss -tulpn or netstat -tulpn.
  6. On systemd systems, pull deeper logs with journalctl -u <name> -f for real-time diagnosis.
  7. Once resolved, make sure the service is set to persist across reboot (chkconfig ... on or systemctl enable ...).

Use netstat to find port conflicts

In the preceding example, httpd can't be started because something is
already listening on the port. To find out what's listening, you can run the
netstat command.

Run the following command to display a list of listening programs and the
ports that they're using:

# netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 10.176.77.113:3306          0.0.0.0:*                   LISTEN      28509/mysqld
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      2113/nc
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1115/master
tcp        0      0 :::22                       :::*                        LISTEN      1051/sshd

The output shows that the nc program (which appears in the Program name
column) is listening on port 80 (which appears in the Local Address
column). Stopping this program should enable httpd to be started.

Note: For more information about the netstat command, see Check listening ports with netstat.

Check xinetd status

If the service isn't running, it might be because a super-server such as
an Extended Internet Service Daemon (xinetd) is being used to launch the
program when a connection is received. If this is the case, starting the
service might have resolved the issue. Run the following command to verify
that the issue is resolved:

$ sudo service xinetd status
xinetd (pid  8795) is running...

Check logs

If you can’t start your service, review your logs to
see if they contain information about the issue.

Next steps

After you're sure that the application is running, check the
server resources to verify how much
your application is consuming.


Did this page help you?