# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias sud='sudo apt-get update'
alias sug='sudo apt-get upgrade'
alias last='last | less'
alias rq='sudo repquota -s /home'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
First, edit your ~/.bashrc
#vi ~/.bashrc
and make sure that it contains the following three lines (if not add them editing the file)
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
After this all you have to do is edit your ~/.bash_aliases file and add your own aliases.
#vi ~/.bash_aliases
Examples
alias dld='cd ~/downloads'
alias x11='nano /etc/X11/XF86Config-4′
alias pak='cd /var/cache/apt/archives'
Save and exit the file.
In the above examples, "dld", "x11″ and "pak" commands will execute the exact command from the right side of the equal sign.
参考:http://snipplr.com/view/8292/
http://www.debianadmin.com/howto-create-your-own-aliases-in-debian.html---评论也可以
本文介绍了如何在Bash shell中设置别名以简化常用命令的输入,通过编辑~/.bashrc和~/.bash_aliases文件可以轻松实现命令快捷方式。
5131

被折叠的 条评论
为什么被折叠?



