Environment variables and aliases
Environment variables were covered in Chapter2, Working with Variables. Here is a cool trick that I learned years ago that can really help when using the command line. Most Linux systems generally have several standard directories under $HOME
such as Desktop, Downloads, Music, Pictures, and so on. I personally do not like typing the same things over and over again and so do this to help use the system more efficiently. Here are some of the lines that I have added to my /home/guest1/.bashrc file
:
export BIN=$HOME/bin alias bin="cd $BIN" export DOWN=$HOME/Downloads alias down="cd $DOWN" export DESK=$HOME/Desktop alias desk="cd $DESK" export MUSIC=$HOME/Music alias music="cd $MUSIC" export PICTURES=$HOME/Pictures alias pictures="cd $PICTURES" export BOOKMARKS=$HOME/Bookmarks alias bookmarks="cd $BOOKMARKS" # Packt- Linux Scripting Bootcamp export LB=$HOME/LinuxScriptingBook alias lb="cd $LB" # Source lbcur . $LB/source.lbcur.txt
Using this approach you...