Making a Command Alias
First, I get to my home directory and find out what shell I am using. I then find out what dot files I have. I then start up a vi session on the .bashrc file.
$ cd $ echo $SHELL /bin/bash $ ls -a ./ .htpasswd .wusage/ ../ .pine-debug1 bin/ .bash_history .pine-debug2 hold/ .bash_logout .pinerc htsdata/ .bash_profile .redirect stage/ .bashrc .screenrc store/ $ vi .bashrc
I use the vi editor to add this line to my .bashrc file:
I then save my .bashrc file and exit the vi editor.alias ll='ls -lst'
Then watch what happens when I use my ll alias in one of my directories without having first restarted the shell. The alias is not recognized. So I need to use the source command on the .bashrc file. I could also have just logged off and logged on again. Then my ll alias works.
$ cd store/test $ ll bash: ll: command not found $ source .bashrc $ ll total 5 1 -rw-r--r-- 1 december december 21 Dec 19 21:59 applebad.txt 1 -rw-r--r-- 1 december december 23 Dec 19 21:41 applegood.txt 1 -rw-r--r-- 1 december december 21 Dec 19 21:38 bag.txt 1 -rw-r--r-- 1 december december 91 Dec 19 21:19 basket.txt 1 -rw-r--r-- 1 december december 21 Dec 19 21:19 apple.txt $