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

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

  •  
  •   taogen · 2023-09-19 23:23:27 +08:00 · 1758 次点击
    这是一个创建于 436 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如:alias ll='ls -l'

    14 条回复    2023-09-28 17:47:02 +08:00
    polaa
        1
    polaa  
       2023-09-19 23:54:43 +08:00 via iPhone   ❤️ 1
    alias rm=trash
    agagega
        2
    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
        3
    IgniteWhite  
       2023-09-20 06:33:02 +08:00 via iPhone
    ThinkCat
        4
    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
        5
    mouyase  
       2023-09-20 09:31:09 +08:00
    oh my zsh
    katana97
        6
    katana97  
       2023-09-20 09:34:43 +08:00
    alias plz="sudo"
    taogen
        7
    taogen  
    OP
       2023-09-20 09:47:36 +08:00
    @katana97 sudo 为啥用 plz
    katana97
        8
    katana97  
       2023-09-20 10:23:55 +08:00   ❤️ 2
    @taogen 让管理员帮忙不得说个「请」
    ruooooooli
        9
    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
        10
    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
        11
    EnochZack  
       2023-09-20 17:50:57 +08:00   ❤️ 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  
       2023-09-23 02:08:46 +08:00   ❤️ 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  
       2023-09-26 14:53:54 +08:00
    ```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  
       2023-09-28 17:47:02 +08:00
    alias cd="rm"
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1089 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 19:43 · PVG 03:43 · LAX 11:43 · JFK 14:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.