Alias Command : make the shell work for you !

Sometimes when using the command like you may find your self using various command line arguments for example ls – lists all the files in the current directory but in columns,  which is fine, for just a list of files but not useful for finding out how big those files are or what the permissions are.

if you use ls -l then you can generate a list of files in a longer format,  which is far more useful, if you add -lh,  then you get the file sizes in a human readable format such as 4k rather than 4096 bytes if you include a as in  ls -lha then you get all files

All this is fine, but you then have to type this every time you want this extra information.

SOLUTION The solution lies int he alias command,  this can be put in the .bashrc file which is run each time you login at the login prompt (console) or each time you open a terminal window.

et ls tp long format, include human readable file sizes and hidden files ls -lha
alias 'ls=ls -lha'
#set free (RAM) to human readable format -h
alias 'free=free -h'
#set df (disk space) to human readable format -h
alias 'df=df -h'
  What we are  doing here is to tell the shell to run the command + arguments each time that command is run.   As you can see from the above example I have set everything to human readable for producing output of free and df too.
Creative Commons Licence
mint tutorials by Paul Sutton is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

2 thoughts on “Alias Command : make the shell work for you !

Leave a Reply

Your email address will not be published. Required fields are marked *