What is the difference between cat /etc/services and service --status-all?

I would like to know the difference between these commands to show linux services:

cat /etc/services

and

service --status-all

The contents of /etc/services do not actually correspond to the services on your system. That file is actually a mapping of ports to the services that usually use them (say, port 22 by SSH). It's used by tools like netstat to give an understandable name in the output (instead of just dumping the port number). So it might, and usually does, have a large number of services listed that are not actually installed on your system.

The output of service --status-all is actually the status of installed services on your system.

See also:

  • How to read "service --status-all" results
  • man 5 services
  • man 8 service