安装btrfs格式的kubuntu
- 选择手动分区
- 删除所有分区
- 创建500MB,FAT32文件格式的EFI系统分区,挂载点
/boot/efi,标签boot
- 把剩余所有空间创建为btrfs文件格式,挂载点为/
- 安装
备份
TimeShift系统备份
安装
1 2
| sudo apt update sudo apt install timeshift -y
|
图形化配置
配置apt前后自动创建快照
1 2 3
| git clone https://github.com/wmutschl/timeshift-autosnap-apt.git cd timeshift-autosnap-apt sudo make install
|
临时跳过自动快照sudo SKIP_AUTOSNAP=1 apt install 包名
关键系统文件变更自动快照
1 2 3 4
| sudo apt install inotify-tools
sudo 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.sh
sudo 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 /boot
After=local-fs.target
[Service] Type=simple
ExecStart=/usr/local/bin/timeshift-watch-etc.sh
Restart=always RestartSec=5
User=root
StandardOutput=journal StandardError=journal
[Install]
WantedBy=multi-user.target
|
1 2 3 4 5 6 7 8
| sudo systemctl daemon-reload
sudo systemctl enable --now timeshift-watch.service
sudo systemctl status timeshift-watch.service
sudo journalctl -fu timeshift-watch.service
|
systemd服务管理命令
1 2 3 4 5 6
| sudo systemctl stop timeshift-watch.service
sudo systemctl disable timeshift-watch.service
sudo 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-btrfs sudo make install
sudo mkdir -p /etc/systemd/system/grub-btrfsd.service.d sudo 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-reload sudo systemctl enable --now grub-btrfsd
sudo systemctl status grub-btrfsd
sudo 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 update sudo 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/swapfile
sudo rm -f /swap/swapfile
sudo btrfs filesystem mkswapfile --size 16G /swap/swapfile
sudo swapon /swap/swapfile
swapon --show free -h
findmnt -no UUID -T /swap/swapfile
sudo btrfs inspect-internal map-swapfile -r /swap/swapfile
sudo 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-grub
sudo update-initramfs -u
sudo 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 hibernate
systemctl 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-logind
sudo 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.rules
sudo 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.md5
7z 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 update
sudo 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 update sudo apt install -y virtualbox sudo apt install -y virtualbox-ext-pack
virtualbox
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 -y
wget -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.gpg
echo "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.list
rm -f packages.microsoft.gpg sudo apt update
sudo apt install code -y
|
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 -y
curl -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.list
sudo apt update sudo apt install syncthing -y
systemctl --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 syncthing
pgrep -af syncthing
cd ~/.config/syncthing/
rm -f *.lock
systemctl --user reset-failed syncthing.service
sudo systemctl stop syncthing@$USER.service sudo systemctl disable syncthing@$USER.service
sudo systemctl status syncthing@$USER.service
systemctl --user start syncthing.service
systemctl --user status syncthing.service
|
git
1 2 3
| sudo apt update sudo apt install git-all -y git --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=Service ServiceTypes=KonqPopupMenu/Plugin MimeType=inode/directory Actions=OpenGitGui X-KDE-Priority=TopLevel
[Desktop Action OpenGitGui] Name=在此处打开 Git GUI Name[zh_CN]=在此处打开 Git GUI Icon=git-gui Exec=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 -y curl -sSL https://steampp.net/Install/Linux.sh | bash
sudo chmod a+w /etc/hosts
watt-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/nvim
nvim --version
|
stm32cubeide
安装教程
百度网盘
官网下载安装包
vmware
1 2 3 4 5 6 7 8
| sudo deepin-immutable-writable enable
sudo chmod +x VMware-Workstation-*.bundle sudo ./VMware-Workstation-*.bundle
sudo deepin-immutable-writable disable sudo reboot
|
安装失败
1 2 3 4
| sudo vmware-modconfig --console --install-all
sudo apt install libc6-i386
|
卸载:sudo vmware-installer -u vmware-workstation
shell
bash
starship
1 2
| sudo apt install starship nano ~/.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.list
sudo apt update && sudo apt install fish -y
fish_config
|
将 Fish 设置为默认 Shell
1 2 3 4 5
| echo $(which fish) | sudo tee -a /etc/shells
chsh -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.fish
omf 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 zsh
sh -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/shells
chsh -s $(which zsh)
|
通用
FZF
模糊搜索
Ctrl+R:模糊搜索历史命令(比原来的搜索好用 10 倍)
Ctrl+T:模糊搜索当前目录下的文件
Alt+C:模糊搜索并跳转到目录
zoxide
目录跳转(z 目录名)
1 2 3
| sudo apt install zoxide -y echo 'eval "$(zoxide init bash)"' >> ~/.bashrc source ~/.bashrc
|
1 2
| echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc source ~/.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=Application Name=豆包
Exec=xdg-open https://www.doubao.com/chat/?channel=xiazais&from_login=1
Terminal=false Categories=Network
|
在桌面找到这个文件,右键打开属性,勾选允许以程序执行
卸载应用程序
保留配置文件: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
| curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source ~/.bashrc
source ~/.zshrc
omf install nvm
nvm install --lts
npm install -g yarn npm install -g hexo-cli
|
特别栏目:把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/danklinux
sudo apt update
sudo apt install niri xdg-desktop-portal-gnome xdg-desktop-portal-gtk -y
curl -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 -y
sudo add-apt-repository --remove ppa:avengemedia/dms -y
sudo add-apt-repository --remove ppa:avengemedia/danklinux -y
sudo apt autoremove -y
sudo apt clean
sudo apt update
rm -rf ~/.config/niri
rm -rf ~/.config/dms
systemctl --user disable --now dms 2>/dev/null systemctl --user reset-failed 2>/dev/null
|