Is there a way to list all aliases, something like:
$ ls-aliases
.. "cd .."
la "ls -Gla"
gs "git stash"
etc...
Also is it possible to add human readable descriptions to aliases ?
I'm on a MacOSX
All you need to do is type alias at the prompt and any active aliases will be listed. Aliases are usually loaded at initialization of your shell so look in . bash_profile or . bashrc in your home directory.
To see a list of aliases set up on your linux box, just type alias at the prompt. You can see there are a few already set up on a default Redhat 9 installation. To remove an alias, use the unalias command.
You need to put bash shell aliases in the ~/. bashrc file ($HOME/. bashrc) file executed by bash for non-login shells. On most modern Linux distros, you may want to put all your bash alias definitions into a separate file like ~/.
In bash
:
To list all aliases:
alias
To add a comment, just put it at the end of the command, e.g.:
$ alias foo='echo bar #some description'
$ foo
bar
$ alias foo
alias foo='echo bar #some description'
Note that in fish the alias
command creates a function using the alias name that wraps the alias value. So there isn't currently any way to list just "aliases". You can use the functions
command to list the names of all the defined functions (which by definition includes aliases). If you want the names one per line just functions | cat
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With