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

cat /etc/services


service --status-all
  • 3
    Pretty much everything. The two are almost entirely unrelated. – David Foerster Mar 7 '18 at 22:17
  • Look at /etc/services and you'll see some really archaic stuff that never been installed on Linux servers... – RonJohn Mar 8 '18 at 0:11

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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.