大家在 Linux 服务器上会配置那些 alias 提升效率?

2021 年 7 月 15 日
 zhoudaiyu

先说我的(公司): alias cp="cp -i" alias rm="rm -i" alias mv="mv -i" alias ll="ls -l --color=auto" ...

10384 次点击
所在节点    Linux
87 条回复
xnplus
2021 年 7 月 15 日
set -o vi
defunct9
2021 年 7 月 15 日
啥也不配
dzdh
2021 年 7 月 15 日
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
ronman
2021 年 7 月 15 日
up="sudo pacman -Syyu" 🌸🐔
zeroDev
2021 年 7 月 15 日
ll 和 l. 此外还有 sudo -E vim 缩写 sim,vim 定义成 nvim
zeroDev
2021 年 7 月 15 日
@ronman 直接 syyu, 真的有点猛
jingslunt
2021 年 7 月 15 日
啥也不配,麻烦的写脚本,简单的放快捷命令里头
zent00
2021 年 7 月 15 日
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'
FAQ999
2021 年 7 月 15 日
cd ..=..
so1n
2021 年 7 月 15 日
alias ll='ls -l'
alias la='ls -A'
alias rm="trash"
alias cp="cp -i"
alias q="exit"
princelai
2021 年 7 月 15 日
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 root@xx.xx.xx.xx
}

connectxyz() {
sshpass -p 'password' ssh jdblj
}

最后这个要配合~/.ssh/config
```
Host jdblj
HostName xx.xx.xx.xx
User yourusername
Port 60022
```
AoEiuV020
2021 年 7 月 15 日
服务器上的,
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'

不过有些后来就没怎么用了,
tonzeng
2021 年 7 月 15 日
alias cd='rm -rf'
lanlanye
2021 年 7 月 15 日
omz 插件中的 git 和 tmux 相关
Tink
2021 年 7 月 15 日
alias ls='rm -rf /' 效率杠杠的
debuggerx
2021 年 7 月 15 日
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'
AllenHua
2021 年 7 月 15 日
alias ll='ls -alh'

alias df='df -hT'
danc
2021 年 7 月 15 日
alias ls='rm -rf $PWD'
Jat001
2021 年 7 月 15 日
配啥都不如装个 oh-my-zsh 或 oh-my-fish 好用
zjj19950716
2021 年 7 月 15 日
... ../..

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

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

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

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

© 2021 V2EX