Download Article
Download Article
This wikiHow teaches you how to force a currently running service to restart in Linux. You can do this with just a few simple commands regardless of your Linux type.
How to Restart a Service on Linux
- Click the Terminal application in the menu to open a command line.
- Type sudo systemctl restart service , where service is replaced by the command name of the service you want to restart.
- Press ↵ Enter .
Steps
-
Open the command line. Most Linux distributions have a Menu option in the lower-left corner of the screen, inside of which you'll find an application called "Terminal"; this is what you'll open to bring up the command line.
- Since Linux distributions vary in appearance from release to release, you may have to look for the "Terminal" or command line app inside of a folder in the Menu .
- You may find the "Terminal" app on the desktop or in the toolbar at the bottom of the screen instead of in the Menu .
- Some Linux distributions have a command line bar at the top or bottom of the screen.
-
Enter the command to show currently running services. Type ls /etc/init.d into Terminal and press ↵ Enter . This will bring up a list of currently running services and their corresponding command names.
- If this command doesn't work, try ls /etc/rc.d/ instead.
Advertisement -
Find the command name of the service that you want to restart. You'll typically find the name of the service (e.g., "Apache") on the left side of the screen, while the command name (e.g., "httpd" or "apache2", depending on your Linux distribution) will appear on the right side.
-
Enter the restart command. Type sudo systemctl restart service into Terminal, making sure to replace the service part of the command with the command name of the service, and press ↵ Enter .
- For example, to restart Apache on Ubuntu Linux, you would type sudo systemctl restart apache2 into Terminal.
-
Enter your password when prompted. Type in the password that you use for your superuser account, then press ↵ Enter . This should restart the process.
- If the service doesn't restart after doing this, try typing in sudo systemctl stop service , pressing ↵ Enter , and then entering sudo systemctl start service .
Advertisement
Community Q&A
Search
-
QuestionIs it true that SSHD doesn't mean solid state hybrid drive, it means Secure Shell Daemon?Community AnswerIt means both, actually. If you're talking about hard drives and storage, SSHD is correct for solid state hybrid drive. If you're talking about Linux, the Secure Shell Daemon is also correct.
-
QuestionWhat if I need to restart an app, like Firefox browser or Terminal? What command would I use?SomoneCommunity Answer
-
QuestionWhich service controls ssh?Community AnswerIt is just ssh or open-ssh based on your distribution of Linux. Just try both.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Video
Tips
- You can use the "chkconfig" command to add and remove services in your system start-up.Thanks
- To see a comprehensive list of all current services in all directories on your computer, enter ps -A into Terminal.Thanks
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement
Warnings
- Don't stop services at random while trying this out. Some of the services listed are necessary to keep your system stable and running happily.Thanks
Advertisement
About This Article
Article Summary
X
1. Open the command line
2. Enter ls /etc/init.d
or ls /etc/rc.d/
3. Find the name of the service you want to restart.
4. Enter sudo systemctl restart service
where service
is the service name.
5. Enter your password.
Did this summary help you?
Thanks to all authors for creating a page that has been read 510,395 times.
Advertisement