我正在将我的个人桌面从 Windows 迁移到 Ubuntu,我想知道一种简单的方法来备份个人数据,如 Firefox 书签、个人文档等...
在 Windows 中,我手动复制所有内容,而在 Ubuntu 中,我想创建一个 bash 脚本来自动执行此操作。
除了创建文件并使其可执行以及以下简单示例外,我对 bash 脚本一无所知:
#!/bin/bash
cp /files/file.doc /media/flashdrive/
我如何自动检测我当前的配置文件?(我的计算机上目前有 3 个配置文件,一个我不使用,一个是我妻子的(没有书签),还有我的)。
答案1
我建议使用同步(在 Ubuntu 中)。
如果你有数百兆的数据,你可能只想同步/备份修改过的数据。这将提高备份速度。
与其他文件(如 hosts)一样,您可以简单地cp
现在对于 Firefox,您需要找到您正在使用的配置文件,然后profiles.ini
您可以复制 bookmarks.html
您可以使用 grep 来找出profiles.ini使用的文件夹:
grep Path ~/.mozilla/firefox/profiles.ini
将输出:
Path=e8tog617.default
然后删除Path=
sed "s/Path=//g"
backup.sh 如下所示:
rsync -rltDqv ~/Documents/ /media/flashdrive/Documents/
cp ~/.mozilla/firefox/`grep Path ~/.mozilla/firefox/profiles.ini | sed "s/Path=//g"`/bookmarks.html /media/flashdrive/bookmarks.html
cp /etc/hosts /media/flashdrive/hosts
现在,chmod +x
运行你的 backup.sh./backup
答案2
对于 Firefox,我认为您可以使用 Firefox 的“同步”功能来同步您的配置文件。
对于备份文档,您还可以尝试一些像unison或FreeFileSync这样的软件。
答案3
手动备份配置文件
如果您习惯复制文件和文件夹,则可以手动备份您的配置文件。此过程非常简单,只需将单个目录复制到备份位置即可。大部分工作都是查找配置文件文件夹的存储位置。
It's a good idea to first get rid of any unnecessary files to reduce the size of your backup.
Firefox: " Tools -> Options-> Advanced -> Network -> (under Offline Storage or Cached Web Content) -> Clear Now"
Mozilla Suite/SeaMonkey: Edit -> Preferences -> Advanced -> Cache -> Clear Cache, as well as compact your mail.
Thunderbird: Compact your mail.
Completely exit or quit the application. Mozilla Suite and SeaMonkey 1.x users on Windows should also exit Mozilla Quick Launch if its enabled.
Find the "Mozilla" (for Mozilla Suite/SeaMonkey 1.x), "SeaMonkey" (for SeaMonkey 2), "Firefox", or "Thunderbird" folder in the profile folder path that contains the registry.dat file or profiles.ini file and the "Profiles" folder (Windows and Mac) or <profile name> folder (Linux). See Profile folder - Firefox , Profile folder - Thunderbird and Profile folder - SeaMonkey for the location.
Copy the "Mozilla" "SeaMonkey" "Firefox" or "Thunderbird" folder to the backup location. This will back up all profiles in the default location and the "registry.dat" or "profiles.ini" file that keeps track profiles.
If you have created any profiles in a custom location, copy them to the backup location and make a note of the original location.
邮件默认存储在配置文件中。如果您重新配置了 Thunderbird、Mozilla Suite 或 SeaMonkey 以将帐户消息存储在配置文件之外,您还需要复制该帐户的“本地目录”。查看帐户设置以找到每个帐户的本地目录的位置。[编辑] 手动恢复配置文件
要恢复配置文件备份:
Close the application whose profile you're going to restore. If you're using Mozilla Suite or SeaMonkey 1.x you should also exit Mozilla Quick Launch if its enabled.
Copy each folder you backed up to the exact same location that it was in when you made the backup