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