温馨提示×

怎样备份ubuntu compton

小樊
36
2026-10-07 01:10:53
栏目: 智能运维

在 Ubuntu 上“备份 Compton”通常指两种情况之一:

  1. 备份 Compton 的配置文件(最常见、最推荐)
  2. 备份 Compton 程序本身(及安装方式)

下面分别说明。


一、备份 Compton 配置文件(推荐)

Compton 的配置文件一般位于:

~/.config/compton.conf

或者旧版本:

~/.compton.conf

1. 查找配置文件

ls -la ~/.config/compton.conf
ls -la ~/.compton.conf

2. 备份配置文件

cp ~/.config/compton.conf ~/compton.conf.bak

或整体备份配置目录:

cp -r ~/.config/compton.conf /mnt/backup/

3. 恢复配置

cp ~/compton.conf.bak ~/.config/compton.conf

二、备份 Compton 安装信息(便于重装)

1. 查看 Compton 是否通过 apt 安装

which compton
dpkg -l | grep compton

如果是 apt 安装:

sudo apt list --installed | grep compton

重装命令:

sudo apt install compton

2. 如果是编译安装(源码)

需要备份:

  • 源码目录
  • 编译参数
  • 安装路径(通常是 /usr/local/bin/compton)

三、使用 systemd / 自启脚本(如有)

如果你用 systemd 管理 Compton:

~/.config/systemd/user/compton.service

备份:

cp ~/.config/systemd/user/compton.service ~/compton.service.bak

如果是 .xinitrc 或 .profile 启动:

grep compton ~/.xinitrc ~/.profile ~/.bashrc

四、完整备份示例(推荐做法)

mkdir ~/compton-backup
cp ~/.config/compton.conf ~/compton-backup/
cp ~/.config/systemd/user/compton.service ~/compton-backup/ 2>/dev/null
dpkg -l | grep compton > ~/compton-backup/installed.txt

补充说明(重要)

⚠️ 现在很多 Ubuntu 用户已改用 picom(Compton 的 fork)

检查方法:

which picom

如果是 picom,配置文件通常是:

~/.config/picom.conf

如果你愿意,可以告诉我:

  • Ubuntu 版本
  • Compton 还是 Picom
  • 是否用了 i3 / Openbox / KDE

我可以给你更精确的备份方案。

0 踩