More Command Line Interface Magic…. Aliases

Enterprise Linux has a good article on some handy aliases under linux that can make CLI usage much more handy. The only warning I would have is to be careful that an alias you want to create doesn’t conflict with another useful program. (One of the comments noted that ld is the executable of the linker).

If there are aliases that are frequently used (or you commonly mistype)…
alias cd..=’cd ..’

Typing alias at the command prompt gives the list of current aliases, entering the above would alias the typed cd.. to mean cd ..

It can be very handy, although you can do dumb things with these… let’s say you’re reckless and rely on rm asking “are you sure you want to delete” and then rm get’s aliased to rm -f (or worse rm -rf…)

So, think carefully about these possibilities.

The hardcoded list of aliases for most distros can be found in your home directory in the .bashrc file.

System wide aliases on many distros are kept in /etc/bashrc (my .bashrc checks that for systemwide stuff.) On Mandrake/Mandriva, aliases come from the /etc/profile.d directory (/etc/bashrc looks in this directory for anything ending with a .sh) Among these can be path modifications, or aliases, such as the file /etc/profile.d/ which contains all the system-wide aliases.

   Send article as PDF   

Similar Posts