🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

service Command

Beginner Systemd & Services man(1)

Run a System V init script (legacy service management)

👁 8 views 📅 Updated: Mar 15, 2026
SYNTAX
service SCRIPT COMMAND

What Does service Do?

service is a legacy command for managing System V init scripts. It starts, stops, restarts, and checks the status of services. On modern systemd systems, service acts as a compatibility wrapper for systemctl.

service is simpler than systemctl with a consistent syntax: service NAME ACTION. It still works on all Linux distributions and is found in many existing scripts and documentation.

For new work, use systemctl directly. But service remains useful for quick operations and backward compatibility.

Options & Flags

OptionDescriptionExample
start Start a service sudo service nginx start
stop Stop a service sudo service nginx stop
restart Restart a service sudo service nginx restart
status Check service status service nginx status
--status-all List all services service --status-all

Practical Examples

#1 Start service

Starts the nginx service.
$ sudo service nginx start

#2 Check status

Shows if the service is running.
$ service nginx status

#3 Restart

Restarts PostgreSQL.
$ sudo service postgresql restart

#4 List all services

Shows status of all services. [+] running, [-] stopped.
$ service --status-all
Output: [ + ] nginx\n [ + ] postgresql\n [ - ] apache2

#5 Reload config

Reloads configuration without full restart.
$ sudo service nginx reload

Tips & Best Practices

Wrapper for systemctl: On systemd systems, service nginx start actually calls systemctl start nginx. Both work.
Simpler syntax: service name action vs systemctl action name. Some people find service syntax easier to remember.
Use systemctl for new work: systemctl provides more features: enable/disable, mask, journal access. Use service for compatibility only.

Frequently Asked Questions

Should I use service or systemctl?
Use systemctl for full control. service works as a compatibility wrapper and is fine for basic start/stop/restart.
How do I list all services?
service --status-all shows SysV services. systemctl list-units --type=service shows systemd services.
Does service work on modern Linux?
Yes — on systemd systems, service commands are translated to systemctl automatically.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →