V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
taogen
V2EX  ›  macOS

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

  •  
  •   taogen · 220 天前 · 1367 次点击
    这是一个创建于 220 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如:alias ll='ls -l'

    14 条回复    2023-09-28 17:47:02 +08:00
    polaa
        1
    polaa  
       220 天前 via iPhone   ❤️ 1
    alias rm=trash
    agagega
        2
    agagega  
       220 天前
    gst='git status'
    gco='git checkout'
    gap='git apply'
    ...='cd ../..'
    ....='cd ../../..'
    .....='cd ../../../..'
    sl='ls'

    以及典中典的

    python='python3'
    IgniteWhite
        3
    IgniteWhite  
       220 天前 via iPhone
    ThinkCat
        4
    ThinkCat  
       220 天前
    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
        5
    mouyase  
       220 天前
    oh my zsh
    katana97
        6
    katana97  
       220 天前
    alias plz="sudo"
    taogen
        7
    taogen  
    OP
       220 天前
    @katana97 sudo 为啥用 plz
    katana97
        8
    katana97  
       220 天前   ❤️ 2
    @taogen 让管理员帮忙不得说个「请」
    ruooooooli
        9
    ruooooooli  
       220 天前
    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
        10
    kiritoyui  
       220 天前
    #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
        11
    EnochZack  
       219 天前   ❤️ 1
    暂时就这些常用的
    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
        12
    loganovo  
       217 天前   ❤️ 1
    # 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
        13
    swordcoming9527  
       214 天前
    ```bash
    alias ali="ssh a@${CLOUD}"
    alias termux="ssh [email protected] -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
        14
    WUWENZE  
       211 天前
    alias cd="rm"
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3015 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 08:36 · PVG 16:36 · LAX 01:36 · JFK 04:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.