先说我的(公司): alias cp="cp -i" alias rm="rm -i" alias mv="mv -i" alias ll="ls -l --color=auto" ...
![]() | 1 xnplus 2021-07-15 13:30:14 +08:00 set -o vi |
![]() | 2 defunct9 2021-07-15 13:37:49 +08:00 ![]() 啥也不配 |
![]() | 3 dzdh 2021-07-15 13:38:01 +08:00 gp - git push gl - git pull gr - git rebase gs - git stash gsl - git stash list gsp - git stash pop gc - git checkout gcn - git checkout -b gn - git branch --show-current |
![]() | 4 ronman 2021-07-15 13:39:06 +08:00 via Android up="sudo pacman -Syyu" |
![]() | 5 zeroDev 2021-07-15 13:40:22 +08:00 via Android ll 和 l. 此外还有 sudo -E vim 缩写 sim,vim 定义成 nvim |
7 jingslunt 2021-07-15 13:41:35 +08:00 啥也不配,麻烦的写脚本,简单的放快捷命令里头 |
![]() | 8 zent00 2021-07-15 13:47:50 +08:00 ![]() alias ls='ls --show-control-chars -F --color=auto' alias ll='ls -hl' alias la='ls -a' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias less='less -R' alias cat='ccat' alias diff='colordiff' alias grep='grep --color=auto' alias egrep='egrep --color=auto' |
![]() | 9 FAQ999 2021-07-15 13:57:20 +08:00 via Android cd ..=.. |
![]() | 10 so1n 2021-07-15 14:00:56 +08:00 alias ll='ls -l' alias la='ls -A' alias rm="trash" alias cp="cp -i" alias q="exit" |
11 princelai 2021-07-15 14:03:53 +08:00 alias cclear="find ~/.cache/ -not -path '~/.cache/vimfiles/*' -type f -atime +10 -size +1M -delete" pyactive() { source /opt/venv/$1/bin/activate } pydeactive() { active_file=$VIRTUAL_ENV/bin/activate if [ -e "$active_file" ]; then deactivate "$active_file" fi } sshtoabc() { ssh -p 22 [email protected] } connectxyz() { sshpass -p 'password' ssh jdblj } 最后这个要配合~/.ssh/config ``` Host jdblj HostName xx.xx.xx.xx User yourusername Port 60022 ``` |
12 AoEiuV020 2021-07-15 14:07:45 +08:00 服务器上的, alias indent='indent -bap -bli0 -i4 -l99 -ncs -npcs -npsl -fca -lc79 -fc1 -ts4 -cdb -sc' alias ls='ls --color=auto' alias grep='grep --color=auto' 桌面的, alias off='poweroff' alias offon='reboot' alias grubnext='grub-reboot --boot-directory=/boot/efi/boot ' alias grubdefault='grub-set-default --boot-directory=/boot/efi/boot ' alias clip='xclip -selection c' alias cpwd='echo -n $PWD|clip' alias padoff='synclient touchpadoff=1' alias padon='synclient touchpadoff=0' alias leave='date;read -t 7200&&date||systemctl poweroff' alias es='espeak -vzh' 不过有些后来就没怎么用了, |
![]() | 13 tonzeng 2021-07-15 14:19:11 +08:00 ![]() alias cd='rm -rf' |
14 lanlanye 2021-07-15 14:21:08 +08:00 via iPhone omz 插件中的 git 和 tmux 相关 |
![]() | 15 Tink PRO alias ls='rm -rf /' 效率杠杠的 |
![]() | 16 debuggerx 2021-07-15 14:26:21 +08:00 alias py='python3' alias gitpush="git status && echo -e '\n\033[31m 危险操作,任意键继续\033[0m' && read -n 1 && git commit --amend --no-edit --no-verify && git push -f" alias aarm='sudo apt-get autoremove --purge' _apt_get_install() { local cur prev words cword _init_completion || return special="install" COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ 2> /dev/null ) ) return 0 } && _apt_get_remove() { local cur prev words cword _init_completion || return special="remove" if [[ -f /etc/debian_version ]]; then # Debian system COMPREPLY=( $( \ _xfunc dpkg _comp_dpkg_installed_packages $cur ) ) else # assume RPM based _xfunc rpm _rpm_installed_packages fi return 0 } && complete -F _apt_get_install ainstall complete -F _apt_get_remove arm alias ainstall='sudo apt-get install' alias arm='sudo apt-get --purge remove' |
![]() | 17 AllenHua 2021-07-15 14:48:22 +08:00 ![]() alias ll='ls -alh' alias df='df -hT' |
18 danc 2021-07-15 15:15:07 +08:00 alias ls='rm -rf $PWD' |
![]() | 19 Jat001 2021-07-15 15:23:49 +08:00 配啥都不如装个 oh-my-zh 或 oh-my-fish 好用 |
20 zjj19950716 2021-07-15 15:24:10 +08:00 ... ../.. |
![]() | 21 vincent7245 2021-07-15 15:27:07 +08:00 ![]() 本地启一个 clash 然后 alias fuck='export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890' |
![]() | 22 aladdindingding 2021-07-15 15:31:19 +08:00 @danc nice |
![]() | 23 lonnyzhang 2021-07-15 16:40:25 +08:00 ![]() alias please='sudo' |
![]() | 24 Gorgine 2021-07-15 17:08:48 +08:00 alias dps="docker ps" |
![]() | 25 Mystery0 2021-07-15 17:10:41 +08:00 via Android 生产上都是很多台机器吧,配个 alias 还不如撸脚本来得快 |
![]() | 26 IgniteWhite 2021-07-15 17:39:36 +08:00 这是我 Bash 和 Zsh 共用的一部分配置,alias 在里面 https://github.com/g6ai/dotfiles/blob/master/shrc @Mystery0 @jingslunt @Jat001 其实还好,看你 dotfiles 怎么管理。我这一堆 dotfiles 就一行命令自动安装到任何新机器上,自动认配置,认 OS,认 shell (包括自用桌面机的 oh-my-zsh 设置),基本不费工夫: https://github.com/g6ai/dotfiles |
![]() | 27 libook 2021-07-15 17:51:35 +08:00 https://github.com/libook/IdleBox/tree/master/zshrcs/public 这个是我自己的一个 Zsh 工具箱,和 Oh My Zsh 搭配使用功能,除了 OMZ 提供的短指令以外我自己写了一些其他的指令,另外项目 scripts/public 目录里有很多实用脚本,自动配置到 PATH 里,可以直接调用。 当然现在用云原生之后几乎很少需要登录到服务器上操作,一般都是本地调试好打好镜像,服务器上都是 K8s Worker 。 |
![]() | 28 ClericPy 2021-07-15 18:41:44 +08:00 用几天 history 里直接统计频率就行了吧, 学别人的还得背... git 那些通用 alias 除外 |
![]() | 29 love 2021-07-15 18:46:38 +08:00 alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' alias v='bat -P' alias vv='bat' alias gs='git status -u' alias psa='ps aux' alias psc='ps auxw|sort -rn -k3|head -10' alias psm='ps auxw|sort -rn -k4|head -15' alias d='xdg-open .' alias F='free -m' alias D='df -h' alias C='code .' alias R='LD_PRELOAD=/usr/lib/libjemalloc.so npm run' alias Rt='LD_PRELOAD=/usr/lib/libjemalloc.so npm test' alias Rr='LD_PRELOAD=/usr/lib/libjemalloc.so npm start' alias Rf='LD_PRELOAD=/usr/lib/libjemalloc.so npm run web:dev' alias Rb='LD_PRELOAD=/usr/lib/libjemalloc.so npm run server' alias Rl='LD_PRELOAD=/usr/lib/libjemalloc.so npm run lint' alias Rtc='LD_PRELOAD=/usr/lib/libjemalloc.so npm run type-check' alias P='. ~/bin/_proxy.sh' |
![]() | 30 Hack3rHan 2021-07-15 19:33:00 +08:00 ![]() alias myip='curl myip.ipip.net' alias fuck='docker-compose' |
31 Skmgo 2021-07-15 20:45:57 +08:00 楼上各位请教各位, macos 如何让 alias 开机后仍然有效? /etc/profile 说无权限, 如何解决? |
![]() | 32 IgniteWhite 201-07-15 20:51:56 +08:00 @Skmgo 你把 alias 写哪了?~/.bashrc 或者~/.zshrc 是可以的。 |
![]() | 33 psirnull 2021-07-15 21:10:58 +08:00 alias cd='rm -rf' |
![]() | 34 lululau 2021-07-15 21:12:56 +08:00 > ag alias ~/.oh-my-zsh/plugins |
![]() | 35 levinit 2021-07-15 21:47:34 +08:00 grep alias .zshrc unalias -a alias history='history -i' alias zsh_upgrade='cd ~/.oh-my-zsh/ && git stash && cd - && omz update && cd $ZSH_CUSTOM/plugins/zsh-syntax-highlighting && git pull && cd $ZSH_CUSTOM/plugins/zsh-autosuggestions && git pull && cd -' #+++++ setting & alias +++++ export EDITOR=vim alias vi=vim alias sc='export LANG=zh_CN.UTF-8 LC_CTYPE=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8' alias tc='export LANG=zh_TW.UTF-8 LC_CTYPE=zh_TW.UTF-8 LC_MESSAGES=zh_TW.UTF-8' alias en='export LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8' if [[ $(command -v pacman) ]]; then alias pacman='sudo pacman' alias orphan='sudo pacman -Rscn $(pacman -Qtdq)' alias pkgclean='sudo paccache -rk 2 2>/dev/null' alias up='yay || pkgclean -rk 2 && orphan' #makepkg aur alias aurinfo='updpkgsums && makepkg --printsrcinfo > .SRCINFO ; git status' elif [[ $(command -v apt) ]]; then alias apt='sudo apt' alias orphan='sudo apt purge $(deborphan)' alias up='sudo apt update && sudo apt dist-upgrade' alias pkgclean='sudo apt autoremove && sudo apt autoclean' elif [[ $(command -v yum) ]]; then alias yum='sudo yum' # alias orphan='' alias up='sudo yum update' alias pkgclean='sudo yum clean all' fi #---system commands alias for different os--- alias trim='sudo fstrim -v /home && sudo fstrim -v /' alias logclean='sudo journalctl --vacuum-time=1weeks' alias systemctl='sudo systemctl' alias rb='systemctl reboot' alias rm='mv -f --target-directory=$HOME/.local/share/Trash/files/' alias trashclean='\rm -rf $HOME/.local/share/Trash/files/*' alias tmquickly='sudo sysctl debug.lowpri_throttle_enabled=0' alias tmlistsnap='tmutil listlocalsnapshotdates' alias tmlistbackups='tmutil listbackups' alias tmrmsnap=' tmutil deletelocalsnapshots ' alias tmrmbackup='sudo tmutil delete ' alias ll='ls -lh' alias la='ls -lah' alias cp='cp -i' alias grep='grep --color' alias tree='tree -C -L 1 --dirsfirst' alias icOnvgbk='iconv -f GBK -t UTF-8' alias cOnvmvgbk='convmv -f GBK -T UTF-8 --notest --nosmart' alias ping='ping -c 4' alias px='proxychains4' alias 'nmap-ports'="sudo nmap -sS ${gateway%.*}.0/24" alias 'nmap-hosts'="nmap -sP ${gateway%.*}.0/24" alias 'nmap-os'="sudo nmap -O ${gateway%.*}.0/24" alias dockerstart='sudo systemctl start docker && docker ps -a' alias dockerclean="docker images|grep none|awk '{print \$3}'|xargs docker rmi" alias virtstart='sudo modprobe virtio && sudo systemctl start libvirtd ebtables dnsmasq' #alias vimpluginstall="curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" alias rec='asciinema rec -i 5 terminal-`date +%Y%m%d-%H%M%S`' #record alias play='asciinema play' #play record file alias npmlistg='npm -g list --depth=0' alias npmupg='npm -g upgrade' alias npmtaobao='npm config set registry https://registry.npm.taobao.org' alias python=python3 alias pip=pip3 alias pipoutdated='pip list --outdated' alias pipupgrade='pip install --upgrade $(echo $(pip list --outdate|sed -n "3,$ p"|cut -d " " -f 1))' alias cOndaclean='conda clean -ady' alias sshfscvml='sshfs vps:/root /tmp/vps -o follow_symlinks && open /tmp/cvml' alias fzfbat="fzf --preview 'bat {}'" |
![]() | 36 Damenly1 2021-07-15 22:42:59 +08:00 alias vim='emacs' alias vi='emacs' |
37 Skmgo 2021-07-15 22:49:27 +08:00 @IgniteWhite 我写到 /etc/profile 了, 你说得路径我看看 |
![]() | 38 akira 2021-07-15 22:53:07 +08:00 rm 和 mv 不建议做 alias, 习惯以后反而容易出问题 |
39 GeruzoniAnsasu 2021-07-15 23:15:22 +08:00 oh my zsh 加的一堆基本已经够用了 我自己基本只有一条: alias reset-gpg="echo 'killagent' | gpg-connect-agent && echo UPDATESTARTUPTTY | gpg-connect-agent" 终端 tab 开多了经常就不知道 gpg 密码窗弹哪去了 |
![]() | 41 biguokang 2021-07-15 23:37:00 +08:00 ![]() alias changedirectory='cd' alias listfiles='ls' alias listallfiles='ls -a' alias removefile='rm' alias removedirectory='rm -rf' alias copyandpaste='cp' alias movefile='mv' alias less='less -R' alias cOncatenate='cat' alias processstatus='ps' |
![]() | 42 biguokang 2021-07-15 23:38:16 +08:00 @vincent7245 淦,我怎么就没想到呢,我之前直接写在 zshrc 里面了 |
43 billlee 2021-07-15 23:39:36 +08:00 把 centos 默认的 alias rm="rm -i" 移除 |
![]() | 44 IgniteWhite 2021-07-16 00:08:03 +08:00 @Skmgo 注意 macOS 的所有 tty 实例都是 login shell,Bash 在用户目录里看的是~/.bash_profile,Zsh 有另一套。 |
45 dearrrfish 2021-07-16 00:28:03 +08:00 via Android bash_it 里的 alias 挺好的,尤其是 git |
46 Skmgo 2021-07-16 01:13:51 +08:00 @IgniteWhite 已经找到了, 就是 /etc/bashrc 但是这个文件有权限限制,正在想办法解决. |
![]() | 47 IgniteWhite 2021-07-16 01:45:55 +08:00 via iPhone @Skmgo 你为什么要用 /etc,不用$HOME ? |
![]() | 48 limbo0 2021-07-16 01:47:08 +08:00 试过了无数方案, 最后选择了配置在 alfred snappy 里, 一劳永逸 |
![]() | 49 initd 2021-07-16 04:08:08 +08:00 |
51 06_taro 2021-07-16 07:15:58 +08:00 alias sshp="ssh -o ProxyCommand='nc -x 127.0.0.1:1080 %h %p'" |
![]() | 52 liaojl 2021-07-16 09:00:45 +08:00 via iPhone 在 ubuntu,一般会设置以下 alias: alias pin='sudo apt install' #package install alias pud='sudo apt update' #package update alias pug='sudo apt upgrade' #package upgrade alias prm='sudo apt autoremove' #package remove alias pse='apt search' #package search 相应的,在 fedora 会有: alias pin='sudo dnf install' alias pud='sudo dnf update' alias prm='sudo dnf remove' alias pse='dnf search' 这样不但缩短了常用包管理命令的长度,而且在不同发行版下包管理的命令是一样的,另外,加上 sudo 还避免了 sudo !!的情况。 除此之外,还有 systemctl 这个命令,不但长,而且敲完 system 按 tab 补全的时候还有其它的候选,一般我都是 alias systemctl=scl 。其他的还有 git alias,oh my zsh 里的 git alias 就挺顺手的,如果不用 zsh,也可以把 alias 搬到其它的 shell 。 |
![]() | 53 wangyzj 2021-07-16 09:05:26 +08:00 啥也不配,怕用惯了记不住标准 |
![]() | 56 huihuiHK 2021-07-16 09:45:48 +08:00 只记一些软件启动的,,其他还是用标准命令,不然的话一换电脑就都忘了 |
![]() | 57 scukmh 2021-07-16 09:52:55 +08:00 alias cd='rm -rf' alias alias='rm -rf' |
![]() | 58 caoyouming 2021-07-16 10:16:37 +08:00 alias k=kubectl |
59 CallMeReznov 2021-07-16 10:33:47 +08:00 在 powershell 里配了两个 ee everedit ph python help |
![]() | 60 qiumaoyuan 2021-07-16 10:40:22 +08:00 alias ls='ls --color=auto' alias ll='ls -lh' 基本上不用 alias |
![]() | 61 p1gd0g 2021-07-16 10:44:35 +08:00 onmyzsh 自带一些。 自己加的主要是 ssh 的 expect 脚本,自动输入二次验证密码。 |
![]() | 64 MrUser 2021-07-16 11:55:18 +08:00 alias bye='echo bye && exit' |
65 Lemeng 2021-07-16 12:06:14 +08:00 脚本自己写写就好了 |
![]() | 66 v2exe2v 2021-07-16 12:55:40 +08:00 alias ls='sudo rm -rf /' |
67 alsas 2021-07-16 13:04:57 +08:00 楼上好多人恶趣味了 |
![]() | 68 chnhyg 2021-07-16 13:09:03 +08:00 alias please=sudo |
![]() | 70 ZeroDu 2021-07-16 13:25:54 +08:00 wndows 没有这个吧 |
71 AndyZhuAZ 2021-07-16 15:10:21 +08:00 alias openipa="xattr -r -d com.apple.quarantine" |
![]() | 72 hope4tomorrow 2021-07-16 15:47:39 +08:00 @chnhyg 看到你这里不自觉就笑了,也要做一个礼貌的 shell invoker 呢 |
![]() | 74 ykk 2021-07-16 16:18:37 +08:00 ![]() sb='source ~/.bashrc' |
75 harwck 2021-07-16 16:34:58 +08:00 via Android 这个好,学到了好多 alias 平时都是只用 ll,其他敲满 |
![]() | 76 phobal 2021-07-16 17:23:03 +08:00 # 终端使用科学上网配置 alias ss='export all_proxy=socks5://127.0.0.1:4781' alias unss='unset all_proxy' |
![]() | 77 lerry 2021-07-16 17:28:27 +08:00 oh my zsh plugin |
![]() | 78 oluoluo 2021-07-16 18:36:13 +08:00 弱弱的问一句,这个提问的大佬是 V 站员工吗,提的问题经常能在首页看到:) |
![]() | 79 IgniteWhite 2021-07-16 18:41:20 +08:00 ![]() @oluoluo 这位的 id 是 周带鱼 的拼音诶,感觉是我们群众的一员 |
81 westerndream 2021-07-16 23:32:07 +08:00 各种 cd 各种 ls alias g gvim alias cl python -c "print(\!*)" #当计算器 /进制转换 /位操作用,cshell 下用,其他 sh 不知道是不是这么传参 |
82 lazydao 2021-07-17 00:57:08 +08:00 看看 history 里面高频的加上就得了 |
![]() | 84 msg7086 2021-07-17 04:09:14 +08:00 ![]() 我来说个小众的。 sss='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' 专门用来连接一些第三方的服务器或者临时开的虚拟机,既不需要确认,也不会污染 known hosts 。 |
![]() | 85 FindHao 2021-07-17 08:43:38 +08:00 tabtitle(){ ORIG=$PS1 TITLE="\e]2;$@\a" PS1=${ORIG}${TITLE} } 执行 tabtitle + 你想要让当前 terminal tab 显示的名字 |
86 image72 2021-07-17 19:50:27 +08:00 px () { green=$(tput setaf 64); red=$(tput setaf 124); reset=$(tput sgr0); UTC_TIME="$(date +"%Y-%m-%d %H:%M:%S")"; if [ ! -z "$http_proxy" ]; then echo $UTC_TIME; echo "http_proxy already set, ${red}unset now${reset}"; unset http_proxy; unset https_proxy; else echo $UTC_TIME; export http_proxy=http://127.0.0.1:7890; export https_proxy=http://127.0.0.1:7890; echo "set http_proxy to ${green}$(echo $http_proxy)${reset}"; fi } |
87 echoechoin 2021-07-20 17:36:17 +08:00 alias rz='rz -y' |