Networking / Beginners

Commands for Working with Packages and Services

As a Linux administrator, you frequently need to start and stop services and check the status of installed packages or install new packages. The following sections describe the Linux commands that help you to perform these tasks.

The service command

You use the service command to check the status of services and to start, stop, or restart services. You need to restart a service whenever you make a configuration change in order for your changes to take effect. Here's the basic syntax:

service [service] [ start | stop | restart ]

The following paragraphs describe some typical uses of the service command:

  • To check the status of the httpd service (Apache), use this command:
    $ service httpd status
  • To stop the httpd service:
    $ service httpd stop
  • To start the httpd service:
    $ service httpd start
  • To restart the httpd service:
    $ service httpd restart

The only trick to using the service command is that you have to know the name of the service. If you're not sure of the name, you can run the service command to display the status of all services, like this:

$ service --status-all

It will take a few moments to list all the services, but after the command is done, you can scroll through the list to find the service that you're looking for.

Table below lists some of the more common services.

Common Linux Services

Service		Description
atd		Runs commands scheduled by the at command.
autof		Automatically mounts file systems.
crond		Runs programs at specified times.
dhcpd		The DHCP server.
finger		The Internet finger service.
httpd		The Apache Web server.
imap		The IMAP mail protocol.
imaps		Secure IMAP service (SSL).
ipop3		The POP3 mail protocol.
iptables	Automatic packet filtering for firewalls.
isdn		ISDN services.
named		The Bind DNS server.
netf		The network file system.
network		Activates and deactivates all network interfaces.
nfs		Native Unix/Linux network file sharing.
pop3s		Secure POP3 service (SSL).
sendmail	The Sendmail service.
smb		The Samba file and printer sharing service.
snmpd		Simple Network Management Protocol.
telnet		The Telnet server.
[Previous] [Contents] [Next]