If you are unfamiliar with the alias command then you are missing out on an effective and efficient tool. Alias is a way to create a shortcut command in bash. You can take very long commands with several options or triggers and create your own shorthand equivalent of that long command. For Example, for me to get the weather for my local area using the weather-util application I would normally need to type:
weather -f --id=KSLC -c "Salt Lake City" -s UT
Well, that's way to long. I normally only want to know the weather in my local area, so I've created an alias for this long command.
alias weather='/usr/bin/weather -f --id=KSLC -c "Salt Lake City" -s UT'
This command essentially substitutes the longer command to display the weather for Salt Lake City with just the command "weather". I have several alias' in my .bashrc file to make my life easier.
# some ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
#Information
alias weather='/usr/bin/weather -f --id=KSLC -c "Salt Lake City" -s UT'
alias gcalcli='gcalcli --cals all'
#For getting around
alias videos='cd /home/jared/Videos/ && ls'
alias pics='cd /home/jared/Pictures/ && ls'
alias music='cd /home/jared/Music/ && ls'
alias podcasts='cd /home/jared/Podcasts/ && ls'
alias dropbox='cd ~/Dropbox/ && ls'
alias documents='cd ~/Documents/ && ls'
alias notes='cd ~/Notes/ && ls'
alias manti='cd ~/Manti/jared/ && ls'
The first group of alias' are very common shortcuts for the "ls" command. The second group of alias' give me shortcuts for the weather and gcalcli applications which displays the weather and my google calendar information. Finally, the las group gives me shortcuts to commonly used directories. This saves me tons of time as I don't have to type out the complete path of a commonly used directory.
Please share some of your cool alias' that you have implemented.
2 comments:
Just used this one
alias scan='scanimage --mode color -d hp >'
That's a great one. Thanks Dave.
Post a Comment