温馨提示×

如何备份ubuntu compton

小樊
42
2026-10-24 16:39:11
栏目: 智能运维

在 Ubuntu 上“备份 compton”通常有两种理解:

  1. 备份 compton 的配置文件(最常见)
  2. 备份 compton 程序本身(可重新安装)

下面分别说明。


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

Compton 的配置文件一般位于:

~/.config/compton.conf

或旧版本:

~/.compton.conf

备份命令

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

或(如果文件在 home 目录):

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

批量备份(含整个配置目录)

cp -r ~/.config/compton ~/.config/compton.bak

二、查看 Compton 是否通过包管理安装

which compton
dpkg -l | grep compton

如果是 apt 安装的

可记录安装信息:

dpkg --get-selections | grep compton > compton_packages.txt

重装时:

sudo apt install compton

三、备份 Compton 启动方式(重要)

Compton 常通过以下方式启动:

1. 自动启动(GUI)

查看:

~/.config/autostart/compton.desktop

备份:

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

2. i3 / Openbox 等 WM 配置

例如 i3:

~/.config/i3/config

查找:

exec --no-startup-id compton

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

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

五、恢复 Compton 配置

cp ~/backup/compton/compton.conf ~/.config/compton.conf

然后重启 Compton:

killall compton
compton &

如果你用的是 picom(compton 的继任者),命令几乎一样,只是把 compton 换成 picom 即可。

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

  • 你用的是哪种桌面环境(GNOME / KDE / i3 / Openbox)
  • compton 是怎么安装的(apt / 源码)

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

0 踩