How to Restart Services in Linux

Start with "ls /etc/init.d"., Switch to the super user (root)., Using the root user, issue the command "service restart"., The service command controls the starting and stopping of services on a Linux system.

5 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Start with "ls /etc/init.d".

    This will show you the names of your services, if you're not quite sure of the formal name of the service you're looking for.

    The name may not be what you'd expect; Apache is actually httpd, for instance.
  2. Step 2: Switch to the super user (root).

    Do this using the command "su
    -" and then responding to the password prompt.

    If you use sudo, then you could use the command "sudo
    -s" to switch to root, or you could add "sudo" to the front of the following command. , This should restart the service, if the init.d script is complete.

    If this doesn't work, try "service <srvcname> stop"

    followed by "service <srvcname> start"

    which should work for all the services. , The service name can be such things as httpd or mysqld.

    Each of these represents a daemon or application which runs on the system and provides some function to you, your users, or the system itself.
  3. Step 3: Using the root user

  4. Step 4: issue the command "service <srvcname> restart".

  5. Step 5: The service command controls the starting and stopping of services on a Linux system.

Detailed Guide

This will show you the names of your services, if you're not quite sure of the formal name of the service you're looking for.

The name may not be what you'd expect; Apache is actually httpd, for instance.

Do this using the command "su
-" and then responding to the password prompt.

If you use sudo, then you could use the command "sudo
-s" to switch to root, or you could add "sudo" to the front of the following command. , This should restart the service, if the init.d script is complete.

If this doesn't work, try "service <srvcname> stop"

followed by "service <srvcname> start"

which should work for all the services. , The service name can be such things as httpd or mysqld.

Each of these represents a daemon or application which runs on the system and provides some function to you, your users, or the system itself.

About the Author

P

Peter Jimenez

Professional writer focused on creating easy-to-follow lifestyle tutorials.

84 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: