今天发现了一个方便的命令alias。
Tofloor
poster avatar
sy1993
deepin
2013-04-04 23:31
Author
我几乎每天都会更新系统,每次都是sudo apt-get update && sudo apt-get upgrade,好长的一行代码。今天发现了alias这个命令——设置命令别名。
用alise可以用你想要的字符去代替一些经常用的命令。命令格式是:alias 后面加上你的{“别名”=‘命令参数……’}。
比如在终端执行:
  1. alias update='sudo apt-get update && sudo apt-get upgrade‘
Copy the Code
那么以后你只需要输入update就可以更新系统了,是不是很方便!

当然,如果想要删除别名,只需要使用unalias命令。比如删除上面的别名:
  1. unalias update
Copy the Code

送给像我一样的LD新手。
Reply Favorite View the author
All Replies
musmuhe
deepin
2013-04-04 23:46
#1
# Interactive operation...
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
#
# Default to human readable figures
# alias df='df -h'
# alias du='du -h'
#
# Misc
# alias less='less -r'                          # raw control characters
# alias whence='type -a'                        # where, of a sort
# alias grep='grep --color'                     # show differences in colour
# alias egrep='egrep --color=auto'              # show differences in colour
# alias fgrep='fgrep --color=auto'              # show differences in colour
#
# Some shortcuts for different directory listings
# alias ls='ls -hF --color=tty'                 # classify files in colour
# alias dir='ls --color=auto --format=vertical'
# alias vdir='ls --color=auto --format=long'
# alias ll='ls -l'                              # long list
# alias la='ls -A'                              # all but . and ..
# alias l='ls -CF'                              #
Reply View the author
sy1993
deepin
2013-04-05 01:11
#2
额,发现一个问题,这种方法只在一次登录内有效,如果想长期有效,需要将上面的命令加到~/.bashrc中。
Reply View the author
cxbii
deepin
2013-04-05 01:25
#3
别名命令~
Reply View the author
139******99
deepin
2013-04-05 23:59
#4
我更喜欢把常用命令复制到一个文本文件里。
Reply View the author
xliang9550
deepin
2013-04-06 01:49
#5
我在Mint(Mate)中给pluma设置了一个alias,名叫gedit……
Reply View the author