- [Show pagesource]
- [Old revisions]
- [Move]
Global Aliases
Global aliases - Do not have to be at the beginning of the command line.
Typical use is:
alias -g H='| head' alias -g T='| tail' alias -g G='| grep' alias -g L="| less" alias -g M="| most" alias -g B="&|" alias -g HL="--help" alias -g LL="2>&1 | less" alias -g CA="2>&1 | cat -A" alias -g NE="2> /dev/null" alias -g NUL="> /dev/null 2>&1"
Global aliases can be probably bad if not used with reason but the following are useful:
alias -g '¬A'='**/*(.)' alias -g '¬/'='**/*(/)' alias -g '¬O'='*(U)'
I use ¬ because it appears on a UK keyboard and doesn't tend to appear in anything else I type so the global alias is unlikely to apply where I don't want it to. When one of these has been entered in a commandline where filename expansion would be performed, ¬A will expand to all plain files below $PWD, ¬/ all directories and ¬O all files in $PWD only, owned by you. (If you don't have setopt GLOB_DOTS and want to include dotfiles in these, you might want to tuck on a D inside the ellipsis too.)
If you have a symlink from /cdrom to /media/cdrom (or similar), the following global alias allows things like ls /cdrom to do what you intend:
alias -g '/cdrom'='/cdrom/.'


