温馨提示×

ubuntu compton如何备份

小樊
50
2026-09-16 07:41:51
栏目: 智能运维

在 Ubuntu 上,Compton(现在多被 picom 取代)本身只是一个窗口合成器,所谓“备份 Compton”通常指下面几类内容。你可以按需选择。


一、备份 Compton 配置文件(最常见)

Compton 的配置文件一般在:

~/.config/compton.conf
# 或
~/.compton.conf

备份命令

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

恢复命令

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

二、如果是 picom(Compton 的继任者)

配置文件通常是:

~/.config/picom/picom.conf

备份:

cp ~/.config/picom/picom.conf ~/picom.conf.bak

三、备份自动启动设置

如果你在 Ubuntu 中设置了开机启动 Compton:

1. systemd 用户服务

查看是否存在:

systemctl --user list-unit-files | grep compton

如果有:

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

备份:

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

2. 自动启动(Startup Applications)

备份:

cp ~/.config/autostart/compton.desktop ~/compton.desktop.bak

四、备份安装信息(可选)

查看是否安装:

which compton
# 或
dpkg -l | grep compton

记录安装方式(apt / 源码 / snap):

apt list --installed | grep compton

五、一键完整备份(推荐)

mkdir -p ~/backup/compton
cp ~/.config/compton.conf ~/backup/compton/ 2>/dev/null
cp ~/.compton.conf ~/backup/compton/ 2>/dev/null
cp ~/.config/systemd/user/compton.service ~/backup/compton/ 2>/dev/null
cp ~/.config/autostart/compton.desktop ~/backup/compton/ 2>/dev/null

六、补充建议

  • Compton 已停止维护,建议迁移到 picom
  • 重装系统前,只需备份 .conf 文件即可

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

  • 你用的是 Compton 还是 Picom
  • 是 桌面环境(GNOME / XFCE / KDE)

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

0 踩