温馨提示×

compton linux怎么备份

小樊
44
2026-09-30 21:36:52
栏目: 智能运维

在 Linux 下 Compton(现在多被分支 picom 取代)本身只是个合成器(compositor),“备份 Compton”通常指备份它的配置文件和相关启动方式。下面分情况说明。


一、备份 Compton 配置文件(最重要)

1. 找到配置文件

Compton 常见配置文件位置:

~/.config/compton.conf
~/.compton.conf
/etc/xdg/compton.conf

picom 常见配置:

~/.config/picom.conf
~/.config/picom/picom.conf

2. 备份配置

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

或整体备份配置目录:

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

二、备份启动方式(自动启动)

如果你在以下地方配置了 Compton 开机启动,也需要备份:

1. 桌面环境自动启动

~/.config/autostart/compton.desktop
~/.config/autostart/picom.desktop

备份:

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

2. 窗口管理器配置(如 i3 / bspwm / awesome)

例如 i3:

~/.config/i3/config

查找是否有:

exec --no-startup-id compton

备份 i3 配置:

cp ~/.config/i3/config ~/i3.config.bak

三、备份整个用户配置(推荐)

如果你想要“整体备份”:

tar czvf compton_backup.tar.gz \
  ~/.config/compton.conf \
  ~/.config/compton \
  ~/.config/picom.conf \
  ~/.config/autostart/compton.desktop \
  ~/.config/i3/config

四、如果是系统级 Compton(较少见)

sudo cp /etc/xdg/compton.conf /etc/xdg/compton.conf.bak

五、恢复备份

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

然后重启 Compton:

pkill compton
compton &

或(picom):

pkill picom
picom &

六、额外建议(很重要)

  • Compton 已停止维护,建议迁移到 picom
  • 备份时顺手记录:
    • 发行版
    • 桌面环境 / 窗口管理器
    • 显卡驱动(Intel / NVIDIA / AMD)

如果你愿意,可以告诉我: ✅ 用的发行版
✅ 桌面环境(GNOME / KDE / i3 / bspwm)
✅ 是 compton 还是 picom

我可以给你一对一的备份命令。

0 踩