V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
karashoukpan
V2EX  ›  程序员

Linux or mac alias 总结

  •  
  •   karashoukpan · 8 天前 · 972 次点击

    Github 地址: https://github.com/deigmata-paideias/alias

    总结了下 alias 别名

    # Alias
    
    alias for Linux/Mac
    
    > Tips: use `alias` show system alias.
    
    ## nefetch and onefetch
    
    alias s="neofetch"
    
    alias c="onefetch"
    
    ## make
    
    alias mk="make"
    
    ## zsh
    
    alias sz="source ~/.zshrc"
    
    ## fzf
    
    alias f="fzf"
    
    alias ff='fzf --preview "bat --color=always {}"'
    
    ## grep
    
    alias grep="grep --color=auto"
    
    ## claude
    
    alias cl='claude --dangerously-skip-permissions --append-system-prompt "$(cat ~/.claude/system-prompt.txt)"'
    
    ## du
    
    alias du1="du -hd 1"
    
    ## clear
    
    alias clr="clear"
    
    alias c="clear"
    
    ## cd
    
    alias "."="cd .."
    
    alias ".."="cd ../.."
    
    alias "..."="cd ../../.."
    
    alias "...."="cd ../../../.."
    
    or:
    
    alias "cd1"="cd .."
    
    alias "cd2"="cd ../.."
    
    alias "cd3"="cd ../../.."
    
    alias "cd4"="cd ../../../.."
    
    ## kubectl
    
    alias k="kubectl"
    
    alias kg="kubectl get"
    
    alias ke="kubectl edit"
    
    alias kexec="kubectl exec -it"
    
    alias klf="kubectl logs -f"
    
    alias ka="kubectl apply"
    
    alias kcf="kubectl create -f"
    
    alias kd="kubectl describe"
    
    ## git
    
    ~/.gitconfig
    
    

    [alias] # git branch ==> git b br = branch # git commit -s -m "xx" ==> git c "xxx" c = commit -s -m co = checkout ch = cherry-pick dump = cat-file -p hist = log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short st = status type = cat-file -t

    
    alias gg="git clone"
    
    alias gpl="git pull"
    
    alias gps="git push"
    
    alias ga="git add ."
    
    alias gss="git stash save"
    
    alias gsp="git stash pop"
    
    ## docker
    
    alias dex="sudo docker exec -it"
    
    alias drm="docker rm $(docker ps -a -q)" # remove all containers
    
    alias dclean="docker system prune -af" # clean system
    
    ## python 
    
    alias py="python3"
    
    alias pi="pip3 install"
    
    alias sv="source venv/bin/active"
    
    alias pyserve="python3 -m http.server" # pyserve 58080
    
    # grep/egrep
    
    alias grep="grep --color=auto"
    
    # macos ip
    alias myip=ifconfig en1 | grep inet | grep -v inet6 | cut -d ' ' -f2
    
    3 条回复    2026-02-03 16:09:18 +08:00
    AoEiuV020JP
        1
    AoEiuV020JP  
       8 天前
    缩写感觉增加心智负担,这一大堆感觉只有最后几个有些加载,常用的话,pyserve grep myip
    karashoukpan
        2
    karashoukpan  
    OP
       7 天前
    其实主要看是不是用命令行用的多,一般都不会咋用

    但是用起来的时候还是挺好用的
    Dopaminee
        3
    Dopaminee  
       7 天前 via Android
    还是 fish 的 abbr 舒服,自动展开别名,不然有些我都不知道什么意思
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   4305 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 08:33 · PVG 16:33 · LAX 00:33 · JFK 03:33
    ♥ Do have faith in what you're doing.