Operation and Maintenance
Linux Operation and Maintenance
How to start, stop, and enable services in Linux
How to start, stop, and enable services in Linux
Use systemctl to manage Linux services: start and stop for immediate control, enable and disable for boot settings, and status to check service state.

Managing services in Linux is essential for system administration. Whether you're starting a web server, stopping a database, or ensuring a service runs at boot, knowing how to control services is key. Most modern Linux distributions use systemd, so the primary tool is systemctl. Here's how to start, stop, and enable services.
Start a Service
Use the start command to launch a service immediately. This doesn’t set it to start automatically at boot.
systemctl start serviceNameFor example, to start the Apache web server:
systemctl start httpdThe service runs until stopped or the system shuts down.
Stop a Service
To stop a running service, use the stop command.
systemctl stop serviceNameExample: Stop the Nginx web server
systemctl stop nginxThis halts the service but doesn’t prevent it from starting at boot if enabled.
Enable a Service at Boot
Enabling a service ensures it starts automatically when the system boots.
systemctl enable serviceNameExample: Enable Redis to start on boot
systemctl enable redisYou can combine enable with start using:
systemctl enable --now serviceNameThis enables auto-start and starts the service right away.
Disable a Service from Starting at Boot
If you don’t want a service to start automatically, disable it.
systemctl disable serviceNameExample: Disable Bluetooth from auto-starting
systemctl disable bluetoothDisabling doesn’t stop a currently running service—use stop for that.
Check status anytime with:
systemctl status serviceNameIt shows whether the service is active, running, enabled, or failed.
Basically, use start, stop, enable, and disable with systemctl. Most services follow this pattern. Know the exact service name (like sshd, docker, mysql) and you’re good to go.
The above is the detailed content of How to start, stop, and enable services in Linux. For more information, please follow other related articles on the PHP Chinese website!
Hot AI Tools
Undress AI Tool
Undress images for free
AI Clothes Remover
Online AI tool for removing clothes from photos.
Undresser.AI Undress
AI-powered app for creating realistic nude photos
ArtGPT
AI image generator for creative art from text prompts.
Stock Market GPT
AI powered investment research for smarter decisions
Hot Article
Popular tool
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
Hot Topics
20522
7
13634
4
What is the function of services.msc file
Feb 19, 2024 pm 07:05 PM
services.msc is a system file used to manage various services in the Windows operating system. Services are programs that run in the background and provide specific functionality and support to the operating system and other applications. The services.msc file can usually be found in the Control Panel or Run dialog box of your Windows operating system. It provides an interface that allows users to view, start, stop, pause, or resume various system services. Services play an important role in Windows systems. They can
How to deploy and manage services in microservice architecture?
May 17, 2023 am 08:38 AM
With the rapid development of cloud computing, container technology and DevOps, microservice architecture is becoming more and more popular. Compared with traditional monolithic applications, microservices architecture can divide applications into small and autonomous services to achieve better scalability and flexibility. Deploying and managing services is extremely important when synchronizing tasks such as developing, testing, and publishing services, as this affects the performance and availability of the application. Therefore, this article will focus on how to deploy and manage services in a microservice architecture. 1. Automated deployment Automated deployment
Linux how to enable and disable services at boot
Aug 08, 2025 am 10:23 AM
To manage the startup of Linux services, use the systemctl command. 1. Check the service status: systemctlstatus can check whether the service is running, enabled or disabled. 2. Enable the service startup: sudosystemctlenable, such as sudosystemctlenablenginx. If it is started at the same time, use sudosystemctlenable--nownginx. 3. Disable the service startup: sudosystemctldisable, such as sudosystemctldisablecups. If it is stopped at the same time, use sudosystemctldisabl
How to implement distributed service monitoring and management in PHP microservices
Sep 27, 2023 am 08:18 AM
How to implement distributed service monitoring and management in PHP microservices requires specific code examples. In recent years, with the rise of cloud computing and microservice architecture, distributed service monitoring and management has become a very important topic. Implementing distributed service monitoring and management in PHP microservices can not only improve the stability and availability of the system, but also facilitate fault diagnosis and performance optimization. This article will introduce a solution based on Prometheus and Grafana and provide detailed code examples. 1. Prometheus
How to use Linux for system service management and optimization
Aug 04, 2023 am 09:21 AM
How to use Linux for system service management and optimization In most server environments, Linux is the operating system of choice. Its reliability, flexibility, and security make it a top choice among developers and system administrators. A good system administrator needs to know how to manage and optimize Linux system services to ensure stable operation and efficient performance of the server. This article will introduce how to use Linux for system service management and optimization, and provide relevant code examples. 1. System service management: starting and stopping services in Linux
Various ways to start Apache services in Linux system
May 16, 2025 pm 09:39 PM
There are four ways to start Apache services in Linux systems: 1. Use the systemctl command (sudosystemctlstarthttpd), which is suitable for modern Linux distributions; 2. Use the service command (sudoservicehttpdstart), which is suitable for old systems; 3. Use the apachectl command (sudoapachectlstart), which is directly interacting with Apache; 4. Edit the configuration file and restart the service (sudosystemctlrestarttpd or sudoservicehttpdrestart), which is suitable for fields that need to modify the configuration.
Common service problems and their solutions under Linux systems
Jun 18, 2023 am 09:37 AM
In the modern computer network environment, the Linux operating system has become a very popular operating system among enterprise and individual users. Among them, Linux has become an important operating system choice in the server environment. In the Linux system, there are a variety of services and applications that can provide support for our daily work and life. However, we also encounter some problems when using these services. This article will introduce common service problems and their solutions under Linux systems. Apache
How to start, stop, and enable a service using systemctl?
Jun 27, 2025 am 12:53 AM
In a systemd-based Linux system, the systemctl command can be used to manage service status. 1. Check the service status: systemctlstatus service name, confirm whether the service is active, inactive or failed; 2. Start the service: sudosystemctlstart service name, start immediately but not automatically restored; 3. Stop the service: sudosystemctlstop service name, terminate the service process immediately; 4. Set the startup self-start: sudosystemctlenable service name, or add the --now parameter to start at the same time; 5. Cancel the startup self-start: sudosystemctldisable





