Difference between revisions of "Systemctl"
Jump to navigation
Jump to search
↑ https://www.freedesktop.org/software/systemd/man/systemctl.html
↑ https://www.linuxtrainingacademy.com/systemd-cheat-sheet/
(Created page with "<code>systemctl</code> command is used to control the systemd system and service manager.<ref>htt...") |
Tags: Mobile web edit, Mobile edit |
||
| (40 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | <code>[[ | + | {{lowercase}} |
| + | <code>[[wikipedia:https://en.wikipedia.org/wiki/Systemd#Core_components_and_libraries|systemctl]]</code> command is used to control the [[systemd]] system and service manager.<ref>https://www.freedesktop.org/software/systemd/man/systemctl.html</ref> | ||
| + | |||
| + | [[Services]] configuration directory: | ||
| + | [[/etc/systemd/]]system/ | ||
| + | [[sshd.service]] | ||
| + | |||
== Basic Usage == | == Basic Usage == | ||
| − | * <code>[[/systemctl status/]]</code> | + | * <code>[[systemctl status]]</code> or <code>[[systemctl status]] SERVICE_NAME</code> |
| − | * <code>systemctl list-units</code> | + | * <code>[[systemctl stop]]</code> SERVICE_NAME |
| + | * <code>[[systemctl start]]</code> SERVICE_NAME | ||
| + | * <code>[[systemctl restart]]</code> SERVICE_NAME | ||
| + | * <code>[[systemctl reload]]</code> SERVICE_NAME | ||
| + | * <code>[[systemctl cat]] SERVICE_NAME</code> or <code>[[systemctl cat]] SERVICE_NAME.service</code> | ||
| + | * <code>[[systemctl list-timers]]</code> | ||
| + | * <code>[[systemctl list-units]]</code> | ||
** <code>systemctl list-units --all</code> | ** <code>systemctl list-units --all</code> | ||
** <code>systemctl list-units --failed</code> | ** <code>systemctl list-units --failed</code> | ||
| − | ** <code>systemctl list-units --type=service</code> | + | ** <code>[[systemctl list-units --type=service]]</code> |
| − | * List services: <code>[[ | + | * List services: |
| + | ** <code>[[systemctl list-unit-files]]</code><ref>https://www.linuxtrainingacademy.com/systemd-cheat-sheet/</ref> | ||
| + | ** <code>[[systemctl list-unit-files]] --state=enabled</code> | ||
* List services enabled: <code>systemctl list-unit-files --state=enabled</code> | * List services enabled: <code>systemctl list-unit-files --state=enabled</code> | ||
| − | * | + | * Show properties: |
| − | + | ** <code>[[systemctl show]] sshd.service</code> | |
* View dependencies: <code>systemctl list-dependencies sshd.service</code> | * View dependencies: <code>systemctl list-dependencies sshd.service</code> | ||
* Creating new services in: <code>/etc/systemd/system/</code> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files | * Creating new services in: <code>/etc/systemd/system/</code> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files | ||
| − | * <code>systemctl -t mount</code> | + | * <code>[[systemctl -t]] mount</code> |
| − | * <code>systemctl list-units | + | * <code>[[systemctl list-units]] -t mount</code> |
| − | * <code>systemctl enable FS_UNIT_NAME.mount</code> | + | * <code>[[systemctl enable]] FS_UNIT_NAME.mount</code> |
| − | * <code> | + | * <code>[[systemctl enable]] --now [[snap]]d.socket</code> |
| + | * <code>[[systemctl disable]] SERVICE_NAME</code> | ||
| + | * <code>[[systemctl --type swap]]</code> | ||
| + | * <code>[[systemctl daemon-reload]]</code> | ||
| + | * <code>[[systemctl unmask]]</code> | ||
== Activities == | == Activities == | ||
| Line 26: | Line 44: | ||
* Read Why are reboot, shutdown and poweroff symlinks to systemctl?: https://unix.stackexchange.com/questions/77029/why-are-reboot-shutdown-and-poweroff-symlinks-to-systemctl/77030#77030 | * Read Why are reboot, shutdown and poweroff symlinks to systemctl?: https://unix.stackexchange.com/questions/77029/why-are-reboot-shutdown-and-poweroff-symlinks-to-systemctl/77030#77030 | ||
* Create a service that restart on-failure. https://superuser.com/questions/507576/how-to-automatically-restart-a-linux-background-process-if-it-fails | * Create a service that restart on-failure. https://superuser.com/questions/507576/how-to-automatically-restart-a-linux-background-process-if-it-fails | ||
| + | |||
| + | |||
| + | == Related terms == | ||
| + | * <code>[[brew services]]</code> | ||
== See also == | == See also == | ||
| − | * | + | * {{systemctl list}} |
| + | * {{systemctl}} | ||
| + | * [[KVM services]] | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:systemd]] | [[Category:systemd]] | ||
| + | [[Category:systemctl]] | ||
Latest revision as of 23:36, 15 September 2021
systemctl command is used to control the systemd system and service manager.[1]
Services configuration directory:
/etc/systemd/system/ sshd.service
Basic Usage[edit]
systemctl statusorsystemctl status SERVICE_NAMEsystemctl stopSERVICE_NAMEsystemctl startSERVICE_NAMEsystemctl restartSERVICE_NAMEsystemctl reloadSERVICE_NAMEsystemctl cat SERVICE_NAMEorsystemctl cat SERVICE_NAME.servicesystemctl list-timerssystemctl list-unitssystemctl list-units --allsystemctl list-units --failedsystemctl list-units --type=service
- List services:
systemctl list-unit-files[2]systemctl list-unit-files --state=enabled
- List services enabled:
systemctl list-unit-files --state=enabled - Show properties:
systemctl show sshd.service
- View dependencies:
systemctl list-dependencies sshd.service - Creating new services in:
/etc/systemd/system/https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files systemctl -t mountsystemctl list-units -t mountsystemctl enable FS_UNIT_NAME.mountsystemctl enable --now snapd.socketsystemctl disable SERVICE_NAMEsystemctl --type swapsystemctl daemon-reloadsystemctl unmask
Activities[edit]
Basic[edit]
- Read systemd Cheat-sheet: https://www.linuxtrainingacademy.com/systemd-cheat-sheet/
- Enable or disable Automatic updates in your Ubuntu machine
Advanced[edit]
- Read Why are reboot, shutdown and poweroff symlinks to systemctl?: https://unix.stackexchange.com/questions/77029/why-are-reboot-shutdown-and-poweroff-symlinks-to-systemctl/77030#77030
- Create a service that restart on-failure. https://superuser.com/questions/507576/how-to-automatically-restart-a-linux-background-process-if-it-fails
Related terms[edit]
See also[edit]
systemctl [ list-dependencies | list-jobs | list-machines | list-sockets | list-timers | list-unit-files | list-units | list-machines ]- Systemd services:
systemctl[status | is-active | start | daemon-reload | stop | mask|reload|restart|reboot|enable|disable|cat],systemctl list-units,systemctl list-timers,systemctl --failed,systemctl get-default,systemctl --help,.service, .timer, .socket,systemctl restart elasticsearch.service,systemctl status apt-daily,systemctl status oscapd, set-property - KVM services
Advertising: