2021-11-30 18:30:19 +00:00
*Jump to [source ](pacman.rs )*
[`pacman` ](https://wiki.archlinux.org/index.php/pacman ) defines subcommands via flags.
2021-11-10 22:15:30 +00:00
Here, `-S` is a short flag subcommand:
2022-01-05 16:54:33 +00:00
```console
2021-11-30 18:30:19 +00:00
$ pacman -S package
2021-11-10 22:15:30 +00:00
Installing package...
2022-01-05 16:54:33 +00:00
2021-11-10 22:15:30 +00:00
```
Here `--sync` is a long flag subcommand:
2022-01-05 16:54:33 +00:00
```console
2021-11-30 18:30:19 +00:00
$ pacman --sync package
2021-11-10 22:15:30 +00:00
Installing package...
2022-01-05 16:54:33 +00:00
2021-11-10 22:15:30 +00:00
```
Now the short flag subcommand (`-S`) with a long flag:
2022-01-05 16:54:33 +00:00
```console
2021-11-30 18:30:19 +00:00
$ pacman -S --search name
2021-11-10 22:15:30 +00:00
Searching for name...
2022-01-05 16:54:33 +00:00
2021-11-10 22:15:30 +00:00
```
And the various forms of short flags that work:
2022-01-05 16:54:33 +00:00
```console
2021-11-30 18:30:19 +00:00
$ pacman -S -s name
2021-11-10 22:15:30 +00:00
Searching for name...
2022-01-05 16:54:33 +00:00
2021-11-30 18:30:19 +00:00
$ pacman -Ss name
2021-11-10 22:15:30 +00:00
Searching for name...
2022-01-05 16:54:33 +00:00
2021-11-10 22:15:30 +00:00
```
*(users can "stack" short subcommands with short flags or with other short flag subcommands)*
**NOTE:** Keep in mind that subcommands, flags, and long flags are *case sensitive* : `-Q` and `-q` are different flags/subcommands. For example, you can have both `-Q` subcommand and `-q` flag, and they will be properly disambiguated.
Let's make a quick program to illustrate.