alias

From WebHostingNeeds.com
Jump to: navigation, search

Alias is another name. In linux, for larger commands, you can create alias. So instead of typing large command, use the short alias.

To see currently set alias

[[email protected] ~]# alias
alias cp='cp -i'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias off='shutdown -h now'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
alias zf='/usr/bin/php /usr/local/zend/share/ZendFramework/bin/zf.php'
[[email protected] ~]#

Linux shoudown command is "shutdown -h now", instead i made alias "off", so instead of typing "shutdown -h now", just type "off".

alias zf='/usr/bin/php /usr/local/zend/share/ZendFramework/bin/zf.php'

This alias means, when you type zf, it executes "/usr/bin/php /usr/local/zend/share/ZendFramework/bin/zf.php"

To add new alias, edit .bashrc

vi ~/.bashrc

In my installation, i have

[[email protected] ~]# cat  ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias off="shutdown -h now"
alias zf='/usr/bin/php /usr/local/zend/share/ZendFramework/bin/zf.php'

PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib


# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
[[email protected] ~]#