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.
In this tutorial:
- Linux Commands
- Command Shell Basics
- Editing commands
- Wildcards
- Redirection and piping
- Environment variables
- Shell scripts
- Directory and File Handling Commands
- The cd command
- The mkdir command
- The rmdir command
- The ls command
- The cp command
- The rm command
- The mv command
- The touch command
- The cat command
- Commands for Working with Packages and Services
- The rpm command
- Commands for Administering Users
- The usermod command
- The chage command
- The passwd command
- The newusers command
- The groupadd command
- The groupdel command
- Commands for Managing Ownership and Permissions
- The chgrp command
- The chmod command
- Networking Commands
- The ipconfig command
- The netstat command
- The ping command
- The route command
- The traceroute command