]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/gnu-utils/README.md
f5fa81e2f4ea8f0bdd665b689575a663185fdc49
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / gnu-utils / README.md
1 # gnu-utils plugin
2
3 This plugin binds GNU coreutils to their default names, so that you don't have
4 to call them using their prefixed name, which starts with `g`. This is useful
5 in systems which don't have GNU coreutils installed by default, mainly macOS
6 or FreeBSD, which use BSD coreutils.
7
8 To use it, add `gnu-utils` to the plugins array in your zshrc file:
9 ```zsh
10 plugins=(... gnu-utils)
11 ```
12
13 The plugin works by changing the path that the command hash points to, so
14 instead of `ls` pointing to `/bin/ls`, it points to wherever `gls` is
15 installed.
16
17 Since `hash -rf` or `rehash` refreshes the command hashes, it also wraps
18 `hash` and `rehash` so that the coreutils binding is always done again
19 after calling these two commands.
20
21 Look at the source code of the plugin to see which GNU coreutils are tried
22 to rebind. Open an issue if there are some missing.
23
24 ## Other methods
25
26 The plugin also documents two other ways to do this:
27
28 1. Using a function wrapper, such that, for example, there exists a function
29 named `ls` which calls `gls` instead. Since functions have a higher preference
30 than commands, this ends up calling the GNU coreutil. It has also a higher
31 preference over shell builtins (`gecho` is called instead of the builtin `echo`).
32
33 2. Using an alias. This has an even higher preference than functions, but they
34 could be overridden because of a user setting.
35
36 ## Author
37
38 - [Sorin Ionescu](https://github.com/sorin-ionescu).