安装btrfs格式的kubuntu
选择手动分区
删除所有分区
创建500MB,FAT32文件格式的EFI系统分区,挂载点/boot/efi,标签boot
把剩余所有空间创建为btrfs文件格式,挂载点为/
安装
备份 TimeShift系统备份 安装 1 2 sudo apt updatesudo apt install timeshift -y
图形化配置
配置apt前后自动创建快照 1 2 3 git clone https://github.com/wmutschl/timeshift-autosnap-apt.git cd timeshift-autosnap-aptsudo make install
临时跳过自动快照sudo SKIP_AUTOSNAP=1 apt install 包名
关键系统文件变更自动快照 1 2 3 4 sudo apt install inotify-toolssudo nano /usr/local/bin/timeshift-watch-etc.sh
添加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #!/bin/bash DELAY=20 LAST_RUN=0 inotifywait -m -e modify,create,delete,move /etc /boot | while read path action file; do NOW=$(date +%s) if [ $((NOW - LAST_RUN)) -lt $DELAY ]; then continue fi sleep $DELAY timeshift --create --comments "Config modified: $path$file ($action )" --tags C --scripted LAST_RUN=$(date +%s) done
1 2 3 4 sudo chmod +x /usr/local/bin/timeshift-watch-etc.shsudo nano /etc/systemd/system/timeshift-watch.service
写入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [Unit] Description =Timeshift auto snapshot watch /etc /bootAfter =local-fs.target[Service] Type =simpleExecStart =/usr/local/bin/timeshift-watch-etc.shRestart =alwaysRestartSec =5 User =rootStandardOutput =journalStandardError =journal[Install] WantedBy =multi-user.target
1 2 3 4 5 6 7 8 sudo systemctl daemon-reloadsudo systemctl enable --now timeshift-watch.servicesudo systemctl status timeshift-watch.servicesudo journalctl -fu timeshift-watch.service
systemd服务管理命令
1 2 3 4 5 6 sudo systemctl stop timeshift-watch.servicesudo systemctl disable timeshift-watch.servicesudo systemctl restart timeshift-watch.service
GRUB 菜单直接启动快照 1 2 3 4 5 6 7 8 git clone https://github.com/Antynea/grub-btrfs.git cd grub-btrfssudo make installsudo mkdir -p /etc/systemd/system/grub-btrfsd.service.dsudo nano /etc/systemd/system/grub-btrfsd.service.d/override.conf
写入
1 2 3 [Service] ExecStart =ExecStart =/usr/bin/grub-btrfsd --syslog --timeshift-auto
1 2 3 4 5 6 7 sudo systemctl daemon-reloadsudo systemctl enable --now grub-btrfsdsudo systemctl status grub-btrfsdsudo update-grub
优化grub显示
1 sudo nano /etc/default/grub
在文件末尾添加
1 2 GRUB_BTRFS_LIMIT ="20" GRUB_BTRFS_SORT ="newest"
开机时按住 Shift(BIOS 模式) 或 Esc(UEFI 模式) 即可调出grub菜单。 从 GRUB 进入快照系统是只读模式,所有修改都不会写入原系统。可以放心进去测试功能、排查故障,确认正常后再执行永久恢复。 如果确定要回滚到某个快照,进入快照系统后执行:sudo timeshift --restore --scripted 恢复完成后重启,系统就回到对应快照的状态。
BackInTime家目录备份 1 2 sudo apt updatesudo apt install backintime-qt -y
图形化配置
rescuezilla全盘备份
kubuntu26.04,btrfs文件格式,btrfs硬盘,ventoy启动盘
制作启动盘 从ventoy的github发布页 下载linux.tar.gz,解压,插入启动盘,运行VentoyGUI.x86_64,安装(会格式化U盘)或升级启动盘。
启动rescuzilla下载rescuzilla的启动镜像 并放到启动盘中,重启电脑,插入移动硬盘,从rescuzilla启动。
开始备份 全程图形化操作
snapper系统备份 安装教程
启用休眠功能 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 sudo swapoff /swap/swapfilesudo rm -f /swap/swapfilesudo btrfs filesystem mkswapfile --size 16G /swap/swapfilesudo swapon /swap/swapfileswapon --show free -h findmnt -no UUID -T /swap/swapfile sudo btrfs inspect-internal map-swapfile -r /swap/swapfilesudo nano /etc/default/grub
1 2 3 4 5 # 修改前 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" # 修改后(替换为你自己的UUID和偏移量) GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=abc12345-def6-7890-abcd-1234567890ab resume_offset=12345678"
1 2 3 4 5 6 sudo update-grubsudo update-initramfs -usudo nano /etc/systemd/sleep.conf
找到以下两行,取消注释并设置为:
1 2 3 4 5 6 [Sleep] AllowSuspend =yes AllowHibernation =yes AllowSuspendThenHibernate =yes AllowHybridSleep =yes HibernateMode =platform shutdown
测试
1 2 3 4 5 6 sudo systemctl hibernatesystemctl hybrid-sleep systemctl suspend
配置菜单显示
1 2 sudo nano /etc/systemd/logind.conf
找到以下行,取消注释并设置为:
1 2 [Login] HandleHibernateKey =hibernate
1 2 3 4 sudo systemctl restart systemd-logindsudo nano /etc/polkit-1/rules.d/10-enable-hibernate.rules
粘贴以下内容:
1 2 3 4 5 6 7 8 9 polkit.addRule (function (action, subject ) { if (action.id == "org.freedesktop.login1.hibernate" || action.id == "org.freedesktop.login1.hibernate-multiple-sessions" || action.id == "org.freedesktop.login1.hibernate-ignore-inhibit" || action.id == "org.freedesktop.upower.hibernate" ) { return polkit.Result .YES ; } });
1 2 3 4 sudo chmod 644 /etc/polkit-1/rules.d/10-enable-hibernate.rulessudo reboot
压缩文件 平衡压缩用zstd
高压缩率:7z a -mx=9 -mmt=on -md=128m home.tar.7z home.tar
校验 检查压缩包完整性:7z t home.tar.7z 流式MD5哈希校验:
1 2 3 4 md5sum home.tar > home.tar.md57z x -so home.tar.7z | md5sum -c home.tar.md5
用 diff 流式比对:7z x -so home.tar.7z | diff - home.tar
输入法 1 2 3 4 sudo apt updatesudo apt install fcitx5 fcitx5-pinyin fcitx5-config-qt
打开 系统设置 → 自动启动 右上角【添加应用程序】→ 搜索fcitx5,选中添加 系统设置 → 输入设备 → 输入法 输入法框架:选择 Fcitx5 点击【添加输入法】→ 找到【拼音 (Pinyin)】添加到右侧列表
拼音数量、输入法大小等图形化配置
安装应用程序 安装.deb包
进入对应目录
sudo apt install ./xxx.deb
微信 从官网或应用商店下载.deb安装包
edge 从官网下载.deb安装包
VirtualBox虚拟机 1 2 3 4 5 6 7 8 9 sudo apt updatesudo apt install -y virtualboxsudo apt install -y virtualbox-ext-packvirtualbox sudo apt remove --purge virtualbox*sudo apt autoremove --purge
常见问题解决
ToDesk 从官网 下载.deb安装包
vscode 1 2 3 4 5 6 7 8 9 10 11 12 sudo apt update && sudo apt install wget gpg apt-transport-https -ywget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpgecho "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.listrm -f packages.microsoft.gpgsudo apt updatesudo apt install code -y
更新vscode:豆包
Syncthing 官网提供的下载和更新方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 sudo apt install apt-transport-https ca-certificates curl gnupg -ycurl -s https://syncthing.net/release-key.txt | gpg --dearmor | sudo tee /usr/share/keyrings/syncthing-archive-keyring.gpg >/dev/null echo "deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.listsudo apt updatesudo apt install syncthing -ysystemctl --user enable --now syncthing.service systemctl --user status syncthing.service
数据库被占用:Error opening database: resource temporarily unavailable 启动被限制:Start request repeated too quickly 解决方法:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 pgrep -af syncthing sudo pkill -9 -f syncthingpgrep -af syncthing cd ~/.config/syncthing/rm -f *.locksystemctl --user reset-failed syncthing.service sudo systemctl stop syncthing@$USER .servicesudo systemctl disable syncthing@$USER .servicesudo systemctl status syncthing@$USER .servicesystemctl --user start syncthing.service systemctl --user status syncthing.service
git 1 2 3 sudo apt updatesudo apt install git-all -ygit --version
配置深度文件管理器右键菜单启动:@
打开深度文件管理器,按下Ctrl+H显示隐藏文件
进入用户主目录,依次打开路径:.local/share/
在 share 目录下,新建文件夹,命名为deepin,进入该文件夹
再新建文件夹,命名为menu-extensions,进入该文件夹
在 menu-extensions 文件夹内,右键新建「文本文档」,命名为git-gui.desktop~/.local/share/deepin/menu-extensions/git-gui.desktop
双击打开该文件,粘贴以下全部内容,保存并关闭:
1 2 3 4 5 6 7 8 9 10 11 12 [Desktop Entry] Type =ServiceServiceTypes =KonqPopupMenu/PluginMimeType =inode/directoryActions =OpenGitGuiX-KDE-Priority =TopLevel[Desktop Action OpenGitGui] Name =在此处打开 Git GUIName[zh_CN] =在此处打开 Git GUI Icon =git-guiExec =cd %f && git gui
关闭所有文件管理器窗口,重新打开深度文件管理器,右键点击任意文件夹,即可在菜单中看到「在此处打开 Git GUI」选项,点击即可直接启动。
wps office 官网下载.deb安装包
1 2 3 4 5 6 sudo apt update && sudo apt install curl jq libnss3-tools zenity -ycurl -sSL https://steampp.net/Install/Linux.sh | bash sudo chmod a+w /etc/hostswatt-toolkit
neovim 1 2 3 4 5 6 7 8 9 10 11 curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.appimage chmod +x nvim-linux-x86_64.appimage./nvim-linux-x86_64.appimage --version sudo mv nvim-linux-x86_64.appimage /usr/local/bin/nvimnvim --version
stm32cubeide 豆包
百度网盘 官网下载安装包
vmware 1 2 3 4 5 6 7 8 sudo deepin-immutable-writable enable sudo chmod +x VMware-Workstation-*.bundlesudo ./VMware-Workstation-*.bundlesudo deepin-immutable-writable disable sudo reboot
安装失败
1 2 3 4 sudo vmware-modconfig --console --install-allsudo apt install libc6-i386
卸载:sudo vmware-installer -u vmware-workstation
shell bash starship 1 2 sudo apt install starshipnano ~/.bashrc
在文件末尾添加
1 2 # Starship prompt eval "$(starship init bash)"
fish 1 2 3 4 5 6 7 8 curl -fsSL https://download.opensuse.org/repositories/shells:/fish:/release:/4/Debian_12/Release.key | sudo gpg --dearmor -o /usr/share/keyrings/fish-shell.gpg echo "deb [signed-by=/usr/share/keyrings/fish-shell.gpg] https://download.opensuse.org/repositories/shells:/fish:/release:/4/Debian_12/ /" | sudo tee /etc/apt/sources.list.d/fish-shell.listsudo apt update && sudo apt install fish -yfish_config
将 Fish 设置为默认 Shell
1 2 3 4 5 echo $(which fish) | sudo tee -a /etc/shellschsh -s $(which fish)
oh my fish
1 2 3 4 curl -L https://get.oh-my.fish | fish curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
使用omf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 rm -f ~/.config/fish/functions/fish_prompt.fishomf theme omf install bobthefish omf reload bobthefish_display_colors --all omf install git omf install fish-async-prompt omf install battery nano ~/.config/fish/config.fish
将以下配置追加到文件末尾
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 set -g theme_color_scheme gruvbox set -g theme_display_virtualenv yes set -g theme_display_right yes set -g theme_display_nowrite yes set -g theme_display_exit_status yes set -g theme_newline_cursor yes set -g theme_newline_prompt '❯ ' set -g theme_git_async yes
omf reload
zsh 1 2 3 4 5 6 7 sudo apt install zshsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) " git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME /.oh-my-zsh/custom} /themes/powerlevel10k nano ~/.zshrc
把ZSH_THEME="robbyrussell"修改为ZSH_THEME="powerlevel10k/powerlevel10k"
安装字体 并把终端中的字体改成meslolgs nf
1 2 3 4 5 6 7 8 9 10 fc-cache -fv p10k configure 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 nano ~/.zshrc
1 2 3 4 5 6 7 8 9 plugins =( git zsh-autosuggestions zsh-syntax-highlighting history copypath extract sudo )
配置zsh为默认shell
1 2 3 4 5 echo $(which zsh) | sudo tee -a /etc/shellschsh -s $(which zsh)
通用 FZF 模糊搜索
Ctrl+R:模糊搜索历史命令(比原来的搜索好用 10 倍) Ctrl+T:模糊搜索当前目录下的文件 Alt+C:模糊搜索并跳转到目录
zoxide 目录跳转(z 目录名)
1 2 3 sudo apt install zoxide -yecho 'eval "$(zoxide init bash)"' >> ~/.bashrcsource ~/.bashrc
1 2 echo 'eval "$(zoxide init zsh)"' >> ~/.zshrcsource ~/.zshrc
1 2 echo 'zoxide init fish | source' >> ~/.config/fish/config.fish source ~/.config/fish/config.fish
网页应用
豆包
元宝
Word
Excel
PowerPoint
bilibili
vivo办公套件
夸克网盘
百度文库
桌面快捷方式创建方法 在/home/jianyuewushuang/Desktop中创建<名称>.desktop文件,写入以下内容:
1 2 3 4 5 6 7 8 9 10 11 [Desktop Entry] Encoding =UTF-8 Type =ApplicationName =豆包Exec =xdg-open https://www.doubao.com/chat/?channel=xiazais&from_login=1 Terminal =false Categories =Network
在桌面找到这个文件,右键打开属性 ,勾选允许以程序执行
cloude code desktop 1 2 3 curl -fLO "https://downloads.claude.ai/claude-desktop/apt/stable/$(curl -s "https://downloads.claude.ai/claude-desktop/apt/stable/dists/stable/main/binary-$(dpkg --print-architecture) /Packages" | grep '^Filename: pool/main/c/claude-desktop/claude-desktop_' | sort -V | tail -n 1 | cut -d' ' -f2) " sudo apt install ./claude-desktop_*.deb
chafa 在终端中用ANSI协议渲染图片。
1 2 3 4 sudo apt install chafa -ychafa test.png chafa --format ansi test.png
zed 用rust编写的高性能ai友好型编辑器。
官网 官方文档
1 2 3 4 5 curl -f https://zed.dev/install.sh | sh zed . zed --uninstall
卸载应用程序 保留配置文件:sudo apt remove 包名 删除配置文件:sudo apt purge 包名
查找应用程序:
1 2 3 4 5 6 7 8 9 10 11 dpkg -l | grep 关键词 apt list --installed | grep 关键词 dpkg --get-selections dpkg -S 命令名
清理残留的配置文件:sudo apt autoremove --purge 清理不需要的依赖包:sudo apt autoremove
查看包的详细信息:apt show 包名或dpkg -s 包名
开发环境配置 c语言 豆包
python 豆包
nodejs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash source ~/.bashrcsource ~/.zshrcomf install nvm nvm install --lts npm install -g yarn npm install -g hexo-cli curl -fsSL https://get.pnpm.io/install.sh | sh -
rust 1 2 3 4 5 6 7 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh . "$HOME /.cargo/env" source "$HOME /.cargo/env.fish" source "~/.cargo/env.nu" source "$HOME /.cargo/env.tcsh" . "$HOME /.cargo/env.ps1" source "$HOME /.cargo/env.xsh"
包管理器 brew mac os的包管理器。
安装 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 sudo apt updatesudo apt install build-essential procps curl file git/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) " echo >> /home/jianyuelinux/.bashrcecho 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrcsource ~/.bashrcecho >> /home/jianyuelinux/.zshrcecho 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv zsh)"' >> /home/jianyuelinux/.zshrceval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv zsh) " brew --version brew doctor
brew 安装的软件实际存放位置
真正程序:/home/linuxbrew/.linuxbrew/Cellar/软件名/版本号/bin/
软链接(PATH 调用):/home/linuxbrew/.linuxbrew/bin/
使用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 brew update brew search walk brew tap antonmedv/tap brew install walk brew upgrade walk brew uninstall walk brew list brew --prefix
其他 特别栏目:把markdown转为pdf 网页工具 md-to.com
用浏览器插件 MarkView
用浏览器打开markdown文件之后用浏览器另存为pdf
vscode中的markdown preview enhenced(MPE)插件 用浏览器转换(最佳实践)
打开设置
搜索markdown-preview-enhanced.chromePath
把路径改为/usr/bin/microsoft-edge-stable
打开MPE预览,右键预览,点Export->Chrome(Puppeteer)->PDF
用PrinceXML转换
从下载页面 下载Debian 12版本
进入安装包所在目录进行安装sudo dpkg -i prince_16.2-1_debian12_amd64.deb
打开MPE预览,右键预览,点Export->PDF(Prince)
prince的用法(HTML/CSS 转 PDF 专业工具,非商业用途免费)
prince是HTML/CSS 转 PDF 专业工具,非商业用途免费
1 2 3 4 5 prince input.html -o output.pdf prince chapter1.html chapter2.html chapter3.html -o book.pdf
pandoc+wkhtmltopdf(自动化方案)
sudo apt install pandoc sudo apt install wkhtmltopdf
pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf
wkhtmltopdf的用法
wkhtmltopdf 是一个 “无界面浏览器”,专门把 HTML 网页(或 Markdown 转出来的 HTML)高质量转成 PDF 的开源命令行工具
1 2 3 4 5 6 7 8 wkhtmltopdf https://example.com 网页.pdf wkhtmltopdf input.html output.pdf wkhtmltopdf --page-size A4 --margin-top 20mm --margin-bottom 20mm input.html > output.pdf
安装其他桌面 niri和dms 1 2 3 4 5 6 7 8 sudo add-apt-repository ppa:avengemedia/danklinuxsudo apt updatesudo apt install niri xdg-desktop-portal-gnome xdg-desktop-portal-gtk -ycurl -fsSL https://install.danklinux.com | sh
卸载
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 sudo apt purge dms-shell niri -ysudo add-apt-repository --remove ppa:avengemedia/dms -ysudo add-apt-repository --remove ppa:avengemedia/danklinux -ysudo apt autoremove -ysudo apt cleansudo apt updaterm -rf ~/.config/nirirm -rf ~/.config/dmssystemctl --user disable --now dms 2>/dev/null systemctl --user reset-failed 2>/dev/null
生成随机字符串 openssl rand -hex 32