Skip to content

UNIX 工具

参考资料

WSL

wsl --install # 安装Linux
wsl --unregister Ubuntu # 卸载

wsl --set-default Ubuntu # 设置默认
wsl --list -v # 查看安装的Linux

wsl -d Ubuntu # 启动
# exit 退出

wsl --export Ubuntu ./Ubuntu.tar # 导出
wsl --import Ubuntu ./Ubuntu.tar # 导入

包管理器

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" # 安装brew

brew install <formula> # 下载
brew update # 更新软件目录
brew outdated # 查看需要更新
brew upgrade <formula> # 更新软件
brew list --versions # 查看已安装
brew uninstall <formula> # 卸载
brew cleanup # 清理旧版本,brew不会默认做这件事
brew search <formula> # 搜索程序

pacman -S yay # 下载 yay

yay -S name #下载
yay -Sy #更新软件目录
yay -Su #更新所有软件
yay -Q #查看已安装
yay -R name #卸载
yay -Rs name #同时卸载相关依赖,不会卸载复用
yay -Qi name #查看已安装某个
yay -Ss <formula> #搜索程序

终端

Wezterm

  • 配置文件在 ~/.config/wezterm.lua
local wezterm = require 'wezterm';

return {
  -- 主题
  color_scheme = "Tokyo Night",
  -- 取消 Windows 原生标题栏
  window_decorations = "INTEGRATED_BUTTONS|RESIZE",
  -- 初始化窗口大小
  initial_cols = 110,
  initial_rows = 30,
  -- 字体大小
  font_size = 14.0,

  -- 字体
  font = wezterm.font 'Monaspace Radon Medium',

  -- 背景图片
  background = {
    {
      source = {
        -- windows 也是 / 分隔符哈
        File = '',
      },
      hsb = {
        hue = 1.0,
        saturation = 1.0,
        brightness = 1,
      }
    }
  },

  -- 背景透明度
  window_background_opacity = 0.9,
  -- 关闭时无需确认
  window_close_confirmation = 'NeverPrompt',

  -- 默认启动时使用的 Bash
  default_prog = {
    "wsl"
  },

  -- 菜单启动项
  launch_menu = {
    { 
      label = 'PowerShell',
      args = { 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe' },
    },
    { 
      label = 'CMD',
      args = { 'cmd.exe' },
    },
  },

--  ssh_domains = { 
--    { 
--      name = "energy", -- 配置标识域名
--      remote_address = "47.104", -- 配置远程地址
--      username = "root", -- 配置用户名
--    }, 
--  },

  wsl_domains = { 
    { 
      name = "wsl:ubuntu", 
      distribution = "Ubuntu", 
    }, 
  },

  -- 快捷键
  -- 默认快捷键 https://wezfurlong.org/wezterm/config/default-keys.html
  keys = {
    -- Ctrl + p 显示启动菜单
    { key = 'p', mods = 'CTRL', action = wezterm.action.ShowLauncherArgs { flags = 'FUZZY|TABS|LAUNCH_MENU_ITEMS' } },
    -- F11 切换全屏
    { key = 'F11', mods = 'NONE', action = wezterm.action.ToggleFullScreen },
    -- Ctrl + Shift + + 字体增大
    { key = '+', mods = 'SHIFT|CTRL', action = wezterm.action.IncreaseFontSize },
    -- Ctrl + Shift + - 字体减小
    { key = '_', mods = 'SHIFT|CTRL', action = wezterm.action.DecreaseFontSize },
    -- Ctrl + t 打开新标签
    { key = 't', mods = 'CTRL', action = wezterm.action.ShowLauncher },
    -- Ctrl + w 关闭标签
    { key = 'V', mods = 'SHIFT|CTRL', action = wezterm.action.PasteFrom 'Clipboard' },
    -- Ctrl + Shift + 上箭头 垂直分屏
    { key = "UpArrow", mods = "CTRL|SHIFT", action = wezterm.action({ SplitHorizontal = { domain = "CurrentPaneDomain" }})},
    -- Ctrl + Shift + 下箭头 水平分屏
    { key = "DownArrow", mods = "CTRL|SHIFT", action = wezterm.action({ SplitVertical = { domain = "CurrentPaneDomain" }})},
    -- Ctrl + Shift + - 缩小字体
    -- { key = "-", mods = "CTRL|SHIFT", action = wezterm.action.IncreaseFontSize },
    -- Ctrl + Shift + = 扩大字体
    -- { key = "=", mods = "CTRL|SHIFT", action = wezterm.action.DecreaseFontSize },
    -- Ctrl + Shift + 0 重置字体
    -- { key = "0", mods = "CTRL|SHIFT", action = wezterm.action.ResetFontSize },
  }
}

Tabby

  • 备用终端

zsh

  • ohmyzsh 是 zsh 的框架, 用于拓展功能
sh -c "$(curl -fsSL https://gitee.com/pocmon/ohmyzsh/raw/master/tools/install.sh)" #安装
uninstall_oh_my_zsh # 卸载
upgrade_oh_my_zsh # 更新
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k #下载powerlevel10k  

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions # 下载 zsh-autosuggestions 插件

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting # 下载 zsh-syntax-highlighting 插件

# 在 ~/.zshrc 配置ohmyzsh
ZSH_THEME = "powerlevel10k/powerlevel10k"
export PATH="$PATH:/usr/local/bin:/usr/local/sbin" # 加入到环境变量, 根据包管理器安装位置
plugins=(git zsh-autosuggestions z extract) # 加入插件


host_ip=$(cat /etc/resolv.conf |grep "nameserver" |cut -f 2 -d " ") # 获取 wsl 宿主机的 ip 地址
proxy () {
    export all_proxy="socks5://127.0.0.1:1080"
    export http_proxy="socks5://127.0.0.1:1080"
    export https_proxy="socks5://127.0.0.1:1080" # 配置代理
}

# 重启自动配置外观
p10k configure # 重新配置

neovim

brew install neovim # 安装 

mkdir ~/.config/nvim
git clone https://www.lazyvim.org/installation
# 建立lazyvim配置文件

# zsh中配置
export EDITOR=nvim
-- 在 options.lua 改一下缩进
local opt = vim.opt
opt.shiftwidth = 4
nvim
:Mason
随便下喜欢的LSP

完美开箱即用
其实变成了 vim 模式的 IDE

lazygit

  • 几乎不用配置

yazi

终端文件管理器 yazi

brew install yazi ffmpegthumbnailer unar jq poppler fd ripgrep fzf zoxide tldr mcfly xclip
以下是yazi需要的程序,一起下了
ffmpegthumbnailer 视频缩略图
unar 文件预览
jq JSON 预览
poppler PDF 预览
fd 文件搜索
rg 文件内容搜索
fzf 用于快速文件子树导航
zoxide 用于历史目录导航
xclip 支持系统剪贴板

现代 unix 工具

排除掉一些个人不喜欢的

tldr # 简化的man
fzf # 模糊搜索
rg # 代码搜索
fd # find
lsd # ls

dust # 分析磁盘使用情况
duf # 查看挂载设备
dog # dig
glances # top
procs # ps

软件

  • Qemu
  • Lua