Mac 终端你们配置了哪些好用的命令行别名(alias) ?

2023-09-19 23:23:27 +08:00
 taogen

如:alias ll='ls -l'

1724 次点击
所在节点    macOS
14 条回复
polaa
2023-09-19 23:54:43 +08:00
alias rm=trash
agagega
2023-09-20 00:00:12 +08:00
gst='git status'
gco='git checkout'
gap='git apply'
...='cd ../..'
....='cd ../../..'
.....='cd ../../../..'
sl='ls'

以及典中典的

python='python3'
IgniteWhite
2023-09-20 06:33:02 +08:00
ThinkCat
2023-09-20 09:15:39 +08:00
alias vim 'nvim'

# git alias
alias gin 'git init'
alias gia 'git add'
alias gib 'git branch'
alias gif 'git diff'
alias gim 'git merge'
alias gis 'git status'
alias gic 'git commit'
alias gicc 'git checkout'
alias gpul 'git pull'
alias gpus 'git push'
mouyase
2023-09-20 09:31:09 +08:00
oh my zsh
katana97
2023-09-20 09:34:43 +08:00
alias plz="sudo"
taogen
2023-09-20 09:47:36 +08:00
@katana97 sudo 为啥用 plz
katana97
2023-09-20 10:23:55 +08:00
@taogen 让管理员帮忙不得说个「请」
ruooooooli
2023-09-20 10:29:11 +08:00
alias back = git checkout -
alias master = git checkout master
alias dev = git checkout develop
alias lg = lazygit
alias tmx = tmx tmux -2 new-session -A -D -s main
alias cls = clear
kiritoyui
2023-09-20 11:06:59 +08:00
#exa
DISABLE_LS_COLORS=true
alias ls=eza

# get zsh complete kubectl
source <(kubectl completion zsh)
alias kubectl=kubecolor
# make completion work with kubecolor
alias k=kubecolor
compdef kubecolor=kubectl
EnochZack
2023-09-20 17:50:57 +08:00
暂时就这些常用的
alias ls="ls -hG"
alias curl="curl -x http://127.0.0.1:8888"
# kotlin
export KOTLIN_HOME=$HOME/Library/Kotlin
export PATH=$PATH:$KOTLIN_HOME/kotlinc/bin

function kotlinUpgrade() {
if [ ! -d "$myPath"]; then
rm -rf ~/Library/Kotlin
fi
cp -r /Applications/Android\ Studio.app/Contents/plugins/Kotlin ~/Library/
}

alias kotlinUpgrade="kotlinUpgrade"
function kotlinPermission() {
for k in kapt kotlin kotlin-dce-js kotlinc kotlinc-js kotlinc-jvm; do
chmod +x ~/Library/Kotlin/kotlinc/bin/$k
done
}

alias kotlinPermission="kotlinPermission"
function brewALiYun() {
unset HOMEBREW_BOTTLE_DOMAIN
git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

# 以下针对 macOS 系统上的 Homebrew
BREW_TAPS="$(brew tap)"
for tap in core cask{-fonts,-versions}; do
if echo "$BREW_TAPS" | grep -qE "^homebrew/${tap}\$"; then
git -C "$(brew --repo homebrew/${tap})" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-${tap}.git
fi
done

# 重新设置 git 仓库 HEAD
brew update-reset
}

alias brewALiYun="brewALiYun"
loganovo
2023-09-23 02:08:46 +08:00
# brew 命令
alias brewtree="brew deps --tree --installed"
alias brewlist="brew leaves | xargs brew deps --installed --for-each | sed 's/^.*:/$(tput setaf 4)&$(tput sgr0)/'"

# ls 颜色和图标
alias ls="lsd"

# python
alias python=python3

# rm 移动废纸篓
alias rt="trash -F"

# nvim
alias nv="nvim"

# Temp
alias tt="cd ~/Temp && pwd && ls -a"

# Home
alias th="cd ~ && pwd && ls -a"

# Desktop
alias tw="cd ~/Desktop && pwd && ls -a"

# Data
alias td="cd ~/Data && pwd && ls -a"

# Config
alias tc="cd ~/Data/Config && pwd && ls -a"

# tree 颜色
alias trees="\tree -C"
# 调用 tmux 脚本
alias tm="osascript ~/Data/Config/applescripts/tmux.scpt"
# 重载配置文件
alias rr="echo 'reloading...'&&source ~/.zshrc"
# ranger
alias ra='ranger'
# z.lua
#alias zz="z -I"
#alias zb="z -b"
#alias zh='z -I -t .'

alias z="__zoxide_z"
alias zz="__zoxide_zi"

# 加载自定义函数
alias au="autoload -U"
fpath+=~/Data/Config/my-functions
# 代理函数
autoload -U setproxy unproxy getproxy

# fzf 杀进程 fzf 预览
autoload -U fkill preview

# docker ps 美化
autoload -U dockerps
swordcoming9527
2023-09-26 14:53:54 +08:00
```bash
alias ali="ssh a@${CLOUD}"
alias termux="ssh u0_a462@192.168.1.7 -p 8022"
alias ls="ls --color=auto"
alias la="ls -a"
alias ll="ls -l"
alias ..="cd .."
alias vi="nvim"
# 当输入 vim 时,提示使用 neovim(alias vi),同时也屏蔽系统自带的 vim
alias vim="echo -e '\033[0;31mVim\033[0m is deprecated and has been replaced by \033[32mNeovim\033[0m (alias: \033[4mvi\033[0m)'"
alias gs="git status"
# 不常用不用设置 alias ,使用一些好用的工具:比如 zoxide ,zsh-autosuggestions ;配置好 completions ,大部分时候用不着完整输入命令。
```
WUWENZE
2023-09-28 17:47:02 +08:00
alias cd="rm"

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

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

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

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

© 2021 V2EX