Use Alias To Create Linux Command Shortcut
Majority of Apple fans prefer the graphical Mac OS than using its underlying Unix core; system administrators (particular Windows admin) keen on intuitive Linux Desktop and generally trying to avoid the “black and white” command console.
The reason of these is probably simple to understand - command interface requires users to memorize and type each of the commands precisely.
Otherwise, the system will not entertain any mistakes :-)
Thus, you’ll be happier with Linux command prompt only if you’re good with most Linux commands and its respective option switches!
But, it’s good to agree that the command prompt is sometimes much simple and efficient to get system work.
If there is situation where you can’t avoid to type out the long Linux command regularly, create an shortcut of it. The alias command is the trick!
Some examples of using the Linux alias command:
alias gsudo="sudo -l | grep --color=auto"
will set gsudo as the Linux command shortcut to highlight a given command in sudo -l report, i.e. gsudo tar to highlight the tar so that a user could easily confirm that the command is granted to his sudo access list (sudo -l).
alias ccls='export LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:"'
will set ccls as another Linux command shortcut that tweak $LS_COLORS environment variable to ligthen the colorized directory listing (i.e the ls command) in darker console.
If you’re frequently working on Wordpress project in Linux environment, then the alias command will be really useful for setting up command shortcut that change path between wp-content/themes and wp-content/plugins directory. For example, these are the alias command shortcuts that I’ve setup in my VMware environment.
alias cwin='cd /var/www/html/walkernews/wp-includes' alias cthe='cd /var/www/html/walkernews/wp-content/themes' alias cplu='cd /var/www/htmlwalkernews/wp-content/plugins'
So, if anyone find Linux command console hard to use, tell him/her to use the alias to make a command shortcut!
Brief note about the Linux alias command:
1) To display or verify the command shortcuts that defined by alias command, just type alias or alias -p at the command prompt.
2) By default, there is a hidden file called .bashrc in each of the user’s home directory. You can define or set command shortcuts using the alias command here. The .bashrc file will be executed while the .bash_profile is executed as user login (i.e. the shortcuts will be ready whenever user login)
3) While the $HOME/.bashrc only available to individual users, the /etc/bashrc file can be used to define or set alias command shortcut for all users, i.e. globally!
Similar Articles:
» How To Setup Email Alias In Red Hat Linux
» Disable Wordpress Directory Listing In Web Browser
» How To Install Wordpress Blog In 3 Minutes
» Brighten Linux LS Command File Listing With LS_COLORS Trick
» WordPress: Adds wp-caption-text To CSS File For Image Caption Styling
» How To Change WordPress Image Caption Text Style To Superscripts?
» How To Insert Multiple Images In WordPress 2.6 Without Using Shortcode?
![]() |
» HOME - WalkerNews.net
« PREV - How To View RSS Feed In XML Format With Firefox
» NEXT - Testing Adsense Scroll Button






















