Linux 实用配置记录

官方脚本指定国内镜像安装 Docker

  • --mirror参数 可以换成AzureChinaCloud

  • _注:get.docker.com似乎被墙了(2024-06-06)

    # 1. download the script
    curl -fsSL get.docker.com -o install-docker.sh
    # 2. verify the script's content
    # cat install-docker.sh
    # 3. run the script with --dry-run to verify the steps it executes
    # sh install-docker.sh --dry-run
    # 4. run the script either as root, or using sudo to perform the installation.
    sudo sh install-docker.sh --mirror Aliyun
    

Oh My Zsh安装及配置

  1. 安装 zsh
    sudo apt update
    sudo apt install zsh
    
  2. 将 zsh 设置为默认 shell,这条命令会在下次登录时生
    # 查看zsh的版本
    zsh --version
    chsh -s $(which zsh)
    
  3. 安装 Oh My Zsh
    # 查看当前shell 
    echo $SHELL
    # Install oh-my-zsh via curl
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    echo $ZSH
    
  4. 通过编辑 ~/.zshrc 文件来自定义 Oh My Zsh,可以更改主题、添加插件等
    nano ~/.zshrc
    # 更改各种配置
    source ~/.zshrc
    
  5. 常用配置
    # 安装主题 Powerlevel10k 到 Oh My Zsh 自定义目录
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
    # 添加主题(.zshrc)
    ZSH_THEME="powerlevel10k/powerlevel10k"
    source ~/.zshrc
    # 重新运行配置向导
    p10k configure
    # 添加插件(.zshrc)
    plugins=(
      git                 # Git 命令补全
      zsh-autosuggestions # 自动建议
      zsh-syntax-highlighting # 语法高亮
      docker              # Docker 命令补全
      npm                 # npm 命令补全
      yarn                # Yarn 命令补全
      vscode              # VS Code 命令补全
      python              # Python 命令补全
      brew                # Homebrew 命令补全
      zoxide              # 快速的目录跳转, Rust重写后的z
    )
    # 克隆第三方的插件仓库到 Oh My Zsh 的自定义插件目录
    git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
    curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
    # 添加配置(.zshrc)
    export PATH="$HOME/.local/bin:$PATH"
    eval "$(zoxide init zsh)"
    source ~/.zshrc
    # 其他常用配置(.zshrc)
    # Enable command auto-completion
    autoload -Uz compinit
    compinit
    # Enable command history sharing
    setopt SHARE_HISTORY
    # Enable command auto-correction
    setopt CORRECT
    



    Enjoy Reading This Article?

    Here are some more articles you might like to read next:

  • 中文文案排版指南
  • Windows实用配置记录
  • 机箱风扇控制
  • 我的表达欲在递减
  • 滑坡谬误(Slippery Slope)在网络讨论中的显现