Skip to content

Instantly share code, notes, and snippets.

@nullx5
Last active October 5, 2025 03:57
Show Gist options
  • Select an option

  • Save nullx5/929b9af7533183eb5d50f9d46609357d to your computer and use it in GitHub Desktop.

Select an option

Save nullx5/929b9af7533183eb5d50f9d46609357d to your computer and use it in GitHub Desktop.

¿Qué es systemd?

systemd es el init system y gestor de servicios moderno en Linux (sustituye al clásico SysVinit). Se encarga de inicializar el sistema, arrancar servicios, montar sistemas de archivos, gestionar sesiones de usuario, y mucho más.

Arquitectrura systemd basica

+-----------------------------------------------------------+
|                        Usuario                            |
|  systemctl, loginctl, journalctl, hostnamectl, etc.       |
+---------------------------+-------------------------------+
                            |
                            v
+-----------------------------------------------------------+
|                        systemd (PID 1)                    |
|  - Arranca servicios en paralelo                          |
|  - Controla dependencias entre unidades (units)           |
|  - Supervisa procesos                                     |
|  - Monta FS, administra sockets y temporizadores          |
+-----------------------------------------------------------+
                            |
                            v
+-----------------------------------------------------------+
|                      Unidades (Units)                     |
|  .service → servicios                                      |
|  .socket  → sockets                                        |
|  .target  → grupos de unidades (como runlevels)           |
|  .mount   → puntos de montaje                             |
|  .timer   → tareas programadas                            |
|  .device  → dispositivos                                  |
|  .slice   → control de recursos (cgroups)                 |
+-----------------------------------------------------------+
                            |
                            v
+-----------------------------------------------------------+
|                  Cgroups (Control Groups)                 |
|  Controlan recursos (CPU, memoria, I/O) por servicio       |
+-----------------------------------------------------------+

Comandos basicos systemctl

Acción Comando Ejemplo
Iniciar un servicio systemctl start nombre.service sudo systemctl start nginx
Detener un servicio systemctl stop nombre.service sudo systemctl stop nginx
Reiniciar un servicio systemctl restart nombre.service sudo systemctl restart ssh
Recargar configuración systemctl reload nombre.service sudo systemctl reload nginx
Ver estado systemctl status nombre.service systemctl status cron
Habilitar al inicio systemctl enable nombre.service sudo systemctl enable apache2
Deshabilitar al inicio systemctl disable nombre.service sudo systemctl disable apache2
Listar servicios activos systemctl list-units --type=service
Ver unidades fallidas systemctl --failed
Apagar o reiniciar systemctl poweroff, systemctl reboot

Comandos utiles

Comando Descripción
hostnamectl Ver / cambiar nombre del host
loginctl Sesiones de usuario
localectl Configuración de idioma/teclado
timedatectl Fecha, hora y zona horaria
systemd-cgls Árbol jerárquico de servicios en cgroups
systemd-cgtop Monitorea uso de CPU/memoria por unidad
systemd-delta Compara configuraciones modificadas con las originales
systemctl
journalctl
loginctl
hostnamectl
timedatectl
localectl
busctl
machinectl
coredumpctl
systemd-run
systemd-cgls
systemd-cgtop
systemd-escape
--------------------------
TUTORIAL systemd
https://www.fpgenred.es/systemd/

systemd-analyze time
https://command-not-found.com/systemd-analyze
@nullx5
Copy link
Author

nullx5 commented Oct 5, 2025

sudo systemd-analyze

Startup finished in 3.342s (firmware) + 4.052s (loader) + 5.268s (kernel) + 12.025s (userspace) = 24.688s 
graphical.target reached after 12.012s in userspace

sudo systemd-analyze plot > boot.svg

boot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment