my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
6.4 KiB

3 years ago
  1. # Systemd plugin
  2. The systemd plugin provides many useful aliases for systemd.
  3. To use it, add systemd to the plugins array of your zshrc file:
  4. ```zsh
  5. plugins=(... systemd)
  6. ```
  7. ## Aliases
  8. | Alias | Command | Description |
  9. |:-----------------------|:-----------------------------------|:-----------------------------------------------------------------|
  10. | `sc-list-units` | `systemctl list-units` | List all units systemd has in memory |
  11. | `sc-is-active` | `systemctl is-active` | Show whether a unit is active |
  12. | `sc-status` | `systemctl status` | Show terse runtime status information about one or more units |
  13. | `sc-show` | `systemctl show` | Show properties of units, jobs, or the manager itself |
  14. | `sc-help` | `systemctl help` | Show man page of units |
  15. | `sc-list-unit-files` | `systemctl list-unit-files` | List unit files installed on the system |
  16. | `sc-is-enabled` | `systemctl is-enabled` | Checks whether any of the specified unit files are enabled |
  17. | `sc-list-jobs` | `systemctl list-jobs` | List jobs that are in progress |
  18. | `sc-show-environment` | `systemctl show-environment` | Dump the systemd manager environment block |
  19. | `sc-cat` | `systemctl cat` | Show backing files of one or more units |
  20. | `sc-list-timers` | `systemctl list-timers` | List timer units currently in memory |
  21. | **Aliases with sudo** |||
  22. | `sc-start` | `sudo systemctl start` | Start Unit(s) |
  23. | `sc-stop` | `sudo systemctl stop` | Stop Unit(s) |
  24. | `sc-reload` | `sudo systemctl reload` | Reload Unit(s) |
  25. | `sc-restart` | `sudo systemctl restart` | Restart Unit(s) |
  26. | `sc-try-restart` | `sudo systemctl try-restart` | Restart Unit(s) |
  27. | `sc-isolate` | `sudo systemctl isolate` | Start a unit and its dependencies and stop all others |
  28. | `sc-kill` | `sudo systemctl kill` | Kill unit(s) |
  29. | `sc-reset-failed` | `sudo systemctl reset-failed` | Reset the "failed" state of the specified units, |
  30. | `sc-enable` | `sudo systemctl enable` | Enable unit(s) |
  31. | `sc-disable` | `sudo systemctl disable` | Disable unit(s) |
  32. | `sc-reenable` | `sudo systemctl reenable` | Reenable unit(s) |
  33. | `sc-preset` | `sudo systemctl preset` | Reset the enable/disable status one or more unit files |
  34. | `sc-mask` | `sudo systemctl mask` | Mask unit(s) |
  35. | `sc-unmask` | `sudo systemctl unmask` | Unmask unit(s) |
  36. | `sc-link` | `sudo systemctl link` | Link a unit file into the unit file search path |
  37. | `sc-load` | `sudo systemctl load` | Load unit(s) |
  38. | `sc-cancel` | `sudo systemctl cancel` | Cancel job(s) |
  39. | `sc-set-environment` | `sudo systemctl set-environment` | Set one or more systemd manager environment variables |
  40. | `sc-unset-environment` | `sudo systemctl unset-environment` | Unset one or more systemd manager environment variables |
  41. | `sc-edit` | `sudo systemctl edit` | Edit a drop-in snippet or a whole replacement file with `--full` |
  42. | `sc-enable-now` | `sudo systemctl enable --now` | Enable and start unit(s) |
  43. | `sc-disable-now` | `sudo systemctl disable --now` | Disable and stop unit(s) |
  44. | `sc-mask-now` | `sudo systemctl mask --now` | Mask and stop unit(s) |
  45. ### User aliases
  46. You can use the above aliases as `--user` by using the prefix `scu` instead of `sc`.
  47. For example: `scu-list-units` will be aliased to `systemctl --user list-units`.
  48. ### Unit Status Prompt
  49. You can add a token to your prompt in a similar way to the gitfast plugin. To add the token
  50. to your prompt, drop `$(systemd_prompt_info [unit]...)` into your prompt (more than one unit
  51. may be specified).
  52. The plugin will add the following to your prompt for each `$unit`.
  53. ```text
  54. <prefix><unit>:<active|notactive><suffix>
  55. ```
  56. You can control these parts with the following variables:
  57. - `<prefix>`: Set `$ZSH_THEME_SYSTEMD_PROMPT_PREFIX`.
  58. - `<suffix>`: Set `$ZSH_THEME_SYSTEMD_PROMPT_SUFFIX`.
  59. - `<unit>`: name passed as parameter to the function. If you want it to be in ALL CAPS,
  60. you can set the variable `$ZSH_THEME_SYSTEMD_PROMPT_CAPS` to a non-empty string.
  61. - `<active>`: shown if the systemd unit is active.
  62. Set `$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE`.
  63. - `<notactive>`: shown if the systemd unit is *not* active.
  64. Set `$ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE`.
  65. For example, if your prompt contains `PROMPT='$(systemd_prompt_info dhcpd httpd)'` and you set the following variables:
  66. ```sh
  67. ZSH_THEME_SYSTEMD_PROMPT_PREFIX="["
  68. ZSH_THEME_SYSTEMD_PROMPT_SUFFIX="]"
  69. ZSH_THEME_SYSTEMD_PROMPT_ACTIVE="+"
  70. ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE="X"
  71. ZSH_THEME_SYSTEMD_PROMPT_CAPS=1
  72. ```
  73. If `dhcpd` is running, and `httpd` is not, then your prompt will look like this:
  74. ```text
  75. [DHCPD: +][HTTPD: X]
  76. ```