Skip to content

新服务器配置

配置密钥登录

  1. 生成SSH密钥对(如果还没有的话):
    ssh-keygen -t rsa -b 4096 -C "<your_email@example.com>"
    
  2. 将公钥复制到服务器:
    ssh-copy-id user@server_ip
    
  3. 测试密钥登录:
    ssh user@server_ip
    

Fish Shell安装

  1. 安装Fish Shell:
    sudo apt update
    sudo apt install fish
    
    直接输入fish命令即可进入fish shell。
  2. 基本fish配置: fish默认配置已经非常友好,可以直接使用。其配置主目录是~/.config/fish,有config.fish文件用于存放自定义配置。以及functions目录用于存放自定义函数。
    function fish_prompt
       if test "$CMD_DURATION" -gt 1000
          set_color cyan
          echo -n "["
          if test "$CMD_DURATION" -gt 3600000
              set -l hours (math --scale=0 "$CMD_DURATION / 3600000")
              set -l minutes (math --scale=0 "($CMD_DURATION - $hours * 3600000) / 60000")
              set -l seconds (math --scale=2 "($CMD_DURATION - $hours * 3600000 - $minutes * 60000) / 1000")
              printf "%dh %dm %.2fs" $hours $minutes $seconds
          else if test "$CMD_DURATION" -gt 60000
              set -l minutes (math --scale=0 "$CMD_DURATION / 60000")
              set -l seconds (math --scale=2 "($CMD_DURATION - $minutes * 60000) / 1000")
              printf "%dm %.2fs" $minutes $seconds
          else
              set -l seconds (math --scale=2 "$CMD_DURATION / 1000")
              printf "%.2fs" $seconds
          end
          echo -n "]"
          echo # 添加换行符
       end
    
       set_color yellow
       echo -n (date "+%H:%M:%S") " "
       set_color green
       echo -n $USER@(hostname) " "
       set_color magenta
       echo -n (prompt_pwd) " "
       set_color normal
    end
    funcsave fish_prompt
    

function fish_greeting
    set_color --bold blue
    echo "╭─────────────────────────────────────╮"
    echo "│         Welcome to Fish Shell       │"
    echo "╰─────────────────────────────────────╯"
    set_color normal

    set_color green
    echo "🖥️  System: $(uname -s) $(uname -r)"
    echo "👤 User: $(whoami)"
    echo "🏠 Host: $(hostname)"
    echo "📅 Date: $(date '+%Y-%m-%d %H:%M:%S')"
    echo "📂 PWD: $(pwd)"
    set_color normal
    echo ""
end
funcsave fish_greeting
这两个配置分别定义了显示命令执行时间和欢迎信息,可以根据需要进行修改,直接在fish之中运行即可以将对应的函数保存到配置文件functions文件夹中。

Conda安装

可以参考conda安装