In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to start, stop and restart services in Ubuntu and other Linux distributions, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Method 1: use systemd to manage services in Linux
I started with systemd because it is widely accepted.
1. List all services
To manage services, you first need to know which services are available on the system. You can use the systemd command to list all the services on the Linux system:
Systemctl list-unit-files-- type service-all
Systemctl list-unit-files
This command outputs the status of all services. The service states are enabled enabled, disabled disabled, shielded masked (inactive until unshielded), static static, and generated generated.
Combined with the grep command, you can display only the services that are running:
Sudo systemctl | grep running
Display running services systemctl
Now that you know how to reference all the different services, you can start to actively manage them.
Note: the following commands should be replaced with the name of the service you want to manage. (for example: network-manager, ufw, etc.)
2. Start the service
To start the service in Linux, you just need to use its name:
Systemctl start 3. Stop the service
To stop the systemd service, you can use the stop option of the systemctl command:
Systemctl stop 4. Restart the service
To restart the systemd service, use:
Systemctl restart 5. Check service status
You can confirm that you have successfully performed a specific operation by printing the service status:
Systemctl status
This will be output in the following manner:
Systemctl status
This is the content of systemd. Now switch to init.
Method 2: use init to manage services in Linux
Init's command is as simple as systemd's.
1. List all services
To list all Linux services, use:
Service-status-all
Service-status-all
The preceding [-] means disabled and [+] means enabled.
2. Start the service
To start the service in Ubuntu and other distributions, use the command:
Service start3, stop servic
It is equally easy to stop the service.
Service stop4, restart the service
If you want to restart the service, the command is:
Service restart5, check service status
In addition, to check whether the expected results have been achieved, you can output the service status:
Service status
This will be output in the following manner:
Service status
Most importantly, this will tell you whether a service is active (running).
Thank you for reading this article carefully. I hope the article "how to start, stop and restart Services in Ubuntu and other Linux distributions" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.