在debian系统制作alias命令

    # 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


Aliases are shortcuts for certain commands. For example, if your current directory is /usr/bin and you want to navigate quickly to /var/cache/apt/archives you can do a "cd /var/cache/apt/archives", but this is quite long and you probably want to save time. So this is where aliases come in help. You can do only a "archive" or a "pak" command and the same action is accomplished.

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---评论也可以


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值