Gestión de servicios: `systemctl` (systemd)
Controle y gestione servicios y demonios del sistema mediante el comando `systemctl`.
Gestión de servicios: `systemctl` (systemd) es una lección gratuita de Linux Command Line Mastery en CoddyKit. Esta es la lección 2 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Linux Command Line Mastery, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Linux Command Line Mastery incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
What are System Services?
On Linux, many programs run silently in the background to perform essential tasks. These are called services or daemons.
Think of them as silent helpers: a web server, a database, or even your Wi-Fi manager. They often start automatically when your system boots.
Meet systemd
systemd is the initialization system used by most modern Linux distributions (like Ubuntu, Fedora, CentOS).
It's responsible for managing services and processes from boot-up to shut-down, ensuring everything starts and stops in the correct order.
Your Tool: systemctl
To interact with systemd and manage these services, we use the powerful systemctl command.
It's your primary interface for checking status, starting, stopping, enabling, and disabling services on your system.
Check Service Status
The first step is often checking if a service is running. Use systemctl status <service_name>.
Let's check the status of the SSH daemon (sshd), which allows secure remote access to your machine.
systemctl status sshdStarting a Service
If a service isn't running or you've stopped it, you can start it with systemctl start <service_name>.
This command attempts to begin the service immediately. You'll often need root privileges (using sudo) for most system services.
sudo systemctl start sshdStopping a Service
To halt a running service, use systemctl stop <service_name>.
This is useful if you need to perform maintenance or reconfigure a service. Be cautious, as stopping critical services can affect system functionality.
sudo systemctl stop sshdRestart vs. Reload
Restarting (systemctl restart <service>) fully stops and then starts a service. This is often needed after major configuration changes.
Reloading (systemctl reload <service>) tells a service to re-read its configuration without a full restart, minimizing downtime. Not all services support reload.
sudo systemctl restart sshdManaging Autostart
Services can be set to start automatically at boot. This is called enabling the service.
sudo systemctl enable <service>: Configures a service to start on boot.sudo systemctl disable <service>: Prevents a service from starting on boot.
These commands only modify boot behavior; they don't start/stop the service immediately.
sudo systemctl enable sshdListing All Services
To see a list of all loaded services and their current status (active, inactive, enabled, disabled), use systemctl list-units --type=service --all.
This command provides a comprehensive overview of what's configured on your system.
systemctl list-units --type=service --allQuick Check: Service Control
Which command would you use to prevent the apache2 web server service from starting automatically when your Linux system boots up?
Recap: Service Management
You've learned how to manage system services using the powerful systemctl command!
- Use
statusto check a service's state. start,stop,restartto control running services.enableanddisableto manage boot-time behavior.list-units --type=service --allto view all services.
Mastering systemctl is crucial for effective Linux system administration.
Preguntas frecuentes
¿La lección «Gestión de servicios: `systemctl` (systemd)» es gratis?
Sí — el texto completo de «Gestión de servicios: `systemctl` (systemd)» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Linux Command Line Mastery, actualiza a CoddyKit PRO. El curso de Linux Command Line Mastery incluye 4 lecciones en total.
¿Qué aprenderé en «Gestión de servicios: `systemctl` (systemd)»?
Controle y gestione servicios y demonios del sistema mediante el comando `systemctl`. Practicas Linux Command Line Mastery con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Linux Command Line Mastery?
No se requiere experiencia previa. Linux Command Line Mastery en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 2 de 4.
¿Cuánto tiempo toma la lección «Gestión de servicios: `systemctl` (systemd)»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Linux Command Line Mastery?
Sí. Cada lección de Linux Command Line Mastery incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Programación de tareas: `cron` y `at`
- Gestión de servicios: `systemctl` (systemd)
- Automatización de tareas con funciones de shell
- Registro centralizado y rotación con journald y logrotate