Main Content

Making Linux Politically correct

Archive - Originally posted on "The Horse's Mouth" - 2009-11-06 23:17:26 - Graham Ellis

[trainee@easterton ~]$ man ls
Manual page displayed here
[trainee@easterton ~]$ woman ls
-bash: woman: command not found
[trainee@easterton ~]$ alias woman=man
[trainee@easterton ~]$ woman ls
Manual page displayed here
[trainee@easterton ~]$


OK - I'll admit that this is quite a trivial use of the "alias" command which (if your running the default 'bash' shell) lets you rename commands - replacing longer names with shorter ones, and adding in some default options too. Here's an example of that, where I am adding the -F option to all my ls commands, as I would like a trailing @ * or / to indicate a link, executable or directory on my listing:

Dorothy-2:nov09 grahamellis$ ls
LinuxAdmin.book.pdf
LinuxBasicsAdmin.book.pdf
chamber.org.uk.tgz
no_50.rtf
notes
phpvna
pics
try
Dorothy-2:nov09 grahamellis$ alias ls='ls -F'
Dorothy-2:nov09 grahamellis$ ls
LinuxAdmin.book.pdf
LinuxBasicsAdmin.book.pdf
chamber.org.uk.tgz
no_50.rtf
notes
phpvna
pics/
try/
Dorothy-2:nov09 grahamellis$


alias commands remain active only for the life of the current shell - type them in at the command line, and they'll not be transferred to any new windows. And you'll loose them completely when you log out or close the window in which you have set them. If you want to make them permanent, edit them into your .bashrc file - that's the file that's read every time you start a new shell.

oh .. ".bashrc" => "Bourne Again Shell Runtime Commands" if you wondered!