Persistent aliases for zsh
and bash
without having to use an editor.
Inspired by this stack exchange question.
Use one of the following:
git clone https://github.com/talwrii/aliasutil ~/aliasutil
echo source ~/aliasutil/aliasutil.sh >> ~/.bashrc
git clone https://github.com/talwrii/aliasutil ~/aliasutil
echo source ~/aliasutil/aliasutil.zsh >> ~/.zshrc
source /usr/share/zplug/init.zsh
zplug talwrii/aliasutil
zplug install
zplug load
echo "zplug load" >> ~/.zshrc
Run (or add to your init file (~/.zshrc
or ~/.bashrc
)).
source aliasutil.sh
aliasutil load
Thereafter you can run
aliasutil add hello='echo hello'
to create a snippet that is saved and restored.
If you are brave, you can transparently make alias
by calling aliasutil replace-alias
.
This will replace alias
with aliasutil add
aliasutil remove
-- delete an aliasaliasutil list
-- list all persisted aliasesaliasutil load
-- remove aliases (for example for other shells)
-
A stack overflow post discussing this issue https://unix.stackexchange.com/questions/47341/are-there-any-utilities-to-quickly-add-list-and-remove-command-aliases
-
zshnip
(by author) provides snippets rather than aliases.