How to Restart Services on Linux

Author: Lewis Jackson
Date Of Creation: 6 May 2021
Update Date: 1 July 2024
Anonim
how to stop, start, restart and reload a service in Linux
Video: how to stop, start, restart and reload a service in Linux

Content

This wiki page will show you how to restart a service running in Linux. You can do this with just a few simple commands for any version of Linux.

Steps

  1. Open command line. Most Linux distributions have an option Menu In the lower left corner of the screen, you will find an application called "Terminal" inside the menu; These are the options that need to be opened to display the command line.
    • Since every Linux distribution will have different distributions, you may have to search for "Terminal" or a command line application within a directory of options. Menu.
    • You can find the "Terminal" application on your desktop or on the toolbar at the bottom of the screen instead of in Menu.
    • Some Linux distributions have a command line bar at the top or bottom of the screen.

  2. Enter the command to display the currently running services. Import ls /etc/init.d Go to Terminal and press ↵ Enter. This will bring up a list of currently running services and their respective command names.
    • If this command doesn't work, try switching ls /etc/rc.d/.

  3. Find the command name of the service you want to restart. Usually you will find the name of the service (eg "Apache") on the left side of the screen, while the command name (eg "httpd" or "apache2", depending on your Linux distribution) will output shown on the right.

  4. Enter restart command. Import sudo systemctl restart service Go to Terminal, make sure to replace the part service of the command by the service command name and press ↵ Enter.
    • For example, to restart Apache on Ubuntu Linux you would typesudo systemctl restart apache2 into Terminal.
  5. Enter your password when prompted. Enter the password that you use for your superuser account, then tap ↵ Enter. This will restart the service.
    • If the service doesn't restart after doing the above, try typing sudo systemctl stop service, press ↵ Enter, then enter sudo systemctl start service.
    advertisement

Advice

  • You can use the "chkconfig" command to add and remove services in the boot system.
  • To see a complete list of all the services currently present in folders on your computer, type ps -A into Terminal.

Warning

  • Don't randomly stop service to try this. Some of the services listed are considered essential to keep the system stable and running smoothly.