Table of Contents
Aliases in Bash are a useful and powerful way of simplifying commonly used commands/options. ZSH comes with a number of aliases automatically but you may well wish to define your own. Generally though you're better off writing a short function to do things.
Aliases
- snippet.bash
alias ip='ip -c' alias shutup='su -c "shutdown -h now"' alias restart='su -c "reboot"' alias sleep='su -c "hibernate-ram"'
Functions
There are some very neat Awesome Command Line Tools such as wttr.in (GitHub) and cheat.sh (GitHub) and so I set up a few functions…
- snippet.bash
weather () { curl wttr.in/"$@" } weather2 () { curl v2d.wttr.in/"$@" } alias weather_sheffield='curl wttr.in/Sheffield' alias weather_high_neb='curl wttr.in/High+Neb' ## Linux commands https://github.com/chubin/cheat.sheets cheat () { curl cheat.sh/"$@" }
Environment Variables
These are not aliases but instead hold key parameters.
- snippet.bash
# Add the date/time to HISTTIMEFORMAT="%Y/%m/%d %T "