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/initis 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 present2. 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 statusStart / stop / restart
sudo service <service-name> start
sudo service <service-name> stop
sudo service <service-name> restartList 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 :80Enable/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 statusOn 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.servicestatus 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 / disabledStart / 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 itExample equivalent of the legacy service httpd reload:
sudo systemctl reload httpdEnable/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 startupenable 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 maskAttempting 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 bootView 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 today4. Old-to-new command cross-reference
| Task | Legacy (SysVinit) | Modern (systemd) |
|---|---|---|
| Check status | service <name> status | systemctl status <name> |
| Start | service <name> start | systemctl start <name> |
| Stop | service <name> stop | systemctl stop <name> |
| Restart | service <name> restart | systemctl restart <name> |
| Reload config | service <name> reload | systemctl reload <name> |
| Enable at boot | chkconfig <name> on | systemctl enable <name> |
| Disable at boot | chkconfig <name> off | systemctl disable <name> |
| List all services | service --status-all | systemctl list-units --type=service --all |
| View logs | check 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
| Software | RHEL/CentOS/Rocky/Alma name | Debian/Ubuntu name |
|---|---|---|
| Apache | httpd | apache2 |
| MariaDB/MySQL | mariadb or mysqld | mysql or mariadb |
| SSH daemon | sshd | ssh |
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)
- Identify init system (
ps --pid 1 -o comm). - Confirm exact service name for your distro.
- Check current status (
service <name> statusorsystemctl status <name>). - If not running, attempt start and read the failure reason directly from the output.
- If a port conflict is reported, cross-check with
ss -tulpnornetstat -tulpn. - On systemd systems, pull deeper logs with
journalctl -u <name> -ffor real-time diagnosis. - Once resolved, make sure the service is set to persist across reboot (
chkconfig ... onorsystemctl 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 thenetstat 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.
Updated 3 days ago