温馨提示×

linux compton配置怎样备份

小樊
32
2026-10-12 14:19:28
栏目: 智能运维

在 Linux 下,compton(现在多被分支 picom 取代)的“配置备份”其实就是备份它的配置文件和相关启动项。下面按常见情况说明。


一、备份 compton 配置文件

1. 常见配置文件位置

compton / picom 的配置文件通常在这里之一:

~/.config/compton.conf
~/.config/picom.conf
~/.compton.conf
/etc/compton.conf
/etc/picom.conf

2. 备份命令

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

或整体备份配置目录:

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

如果是 picom:

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

二、备份启动方式(很重要)

compton 可能通过以下方式启动,建议一并备份:

1. 自动启动配置

  • ~/.xinitrc
  • ~/.xprofile
  • ~/.config/autostart/compton.desktop
  • i3 / bspwm / awesome 等 WM 配置中

例如:

cat ~/.xinitrc | grep compton

备份:

cp ~/.xinitrc ~/.xinitrc.bak

三、一键备份脚本(推荐)

mkdir -p ~/backup/compton
cp ~/.config/compton.conf ~/backup/compton/ 2>/dev/null
cp ~/.config/picom.conf ~/backup/compton/ 2>/dev/null
cp ~/.xinitrc ~/backup/compton/ 2>/dev/null
cp ~/.xprofile ~/backup/compton/ 2>/dev/null
echo "compton 配置已备份到 ~/backup/compton"

四、恢复配置

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

然后重启 compton / 重新登录即可。


五、如果是 picom(补充)

现在很多发行版已用 picom,命令几乎一样:

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

备份:

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

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

  • 用的是 compton 还是 picom
  • 桌面环境(i3 / bspwm / KDE / XFCE)

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

0 踩