# systemctl ```bash To list systemd services we will use systemctl command as below # systemctl list-unit-files Lister tous les services actifs # systemctl | more # systemctl list-units --type service You can pipe the output to grep to search a more specific service as shown below # systemctl | grep "apache2" To check the services alongside the ports they are listening. # netstat -pnltu Savoir si le service est actif # systemctl is-active sshd Connaitre le status dans service (affiche plud d'info que is-active) # systemctl status sshd Savoir si le service a eu un problème au démarrage # systemctl is-failed sshd o check if OpenSSH is enabled, run # systemctl is-enabled sshd Ancien system: check the status of OpenSSH, run # service sshd status You can also check all services by running # chkconfig --list Activer un service au démarrage # systemctl enable sshd Désactiver un service au démarrage # systemctl disable sshd Démarrer un service # systemctl start sshd Arreter un service # systemctl stop sshd Redémarrer un service # systemctl restart sshd Recharger la configuraation d'un service # systemctl reload sshd Voir la configuration d'un service # systemctl cat sshd Propriétés d'un service # systemctl show sshd Editer un service # systemctl edit sshd Masquer un service, c'est à dire d'empêcher le démarrage manuel et automatique de l'unité. Il suffit alors de la démasquer pour pouvoir l'utiliser à nouveau # systemctl mask httpd.service Created symlink from /etc/systemd/system/httpd.service to /dev/null. # systemctl start httpd.service Failed to start httpd.service: Unit is masked. # systemctl unmask httpd.service Removed symlink /etc/systemd/system/httpd.service. # systemctl start httpd.service Afficher les dépendances d'un service # systemctl list-dependencies sshd.service ``` https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units