1. Home
  2. Linux

How to back up Linux settings to a flash drive

Have a flash drive and want to backup your Linux configuration files and settings? If so, we can help! Follow along as we go over two easy ways to back up Linux settings and configuration files to flash drive!

Note: for best results, please use a USB flash drive of at least 4 GB in size. Configuration folders often carry a lot of data, and a small flash drive likely will not be able to handle all of the files.

Method 1 – Back up with Tar

Backing up your Linux settings with the Tar command is a good idea if you’re in a hurry, as it’s a quick process. To create a backup, start by opening up a terminal window. You can do this by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard.

With the terminal window open, use the Tar command to compress the ~/.config/ folder, as it’s the directory where most applications store their settings.

tar czvf linux-settings.tar.gz ~/.config/

Running the above command will output a TarGZ archive file with most of your Linux configurations.

From here, plug in your flash drive into the USB port on your Linux PC. Then, open up the file manager and place linux-settings.targ.gz on it.

Back up other settings folders with Tar

Backing up the ~/.config/ folder to a TarGZ archive is a good way to ensure most of your Linux settings are backed up. That said, not every program stores its setting files there. Some just use the ~/ directory instead. So, if the first backup didn’t get everything, try this one instead.

tar czvf linux-settings.tar.gz ~/

Encrypt Tar backup

Linux settings often contain sensitive information, including passwords, bookmarks, etc. If you’re backing up your Linux settings via Tar to a flash drive, you may want to encrypt the backup as well.

The easiest way to create a backup on Linux is by using the GPG tool. To start the encryption process, use the following gpg command below.

gpg -c linux-settings.tar.gz

With the archive encrypted, delete the unencrypted file.

rm linux-settings.tar.gz

Restore Tar backup

To restore a Tar backup, follow the step-by-step instructions below.

Step 1: Plug in your flash drive into the USB port, and drag the “linux-settings.tar.gz” archive to your home directory (/home/username/).

Step 2: Use GPG to decrypt the TarGZ, if you need to.

gpg linux-settings.tar.gz

Step 3: Restore the backup.

tar xzvf linux-settings.tar.gz -C ~/ --strip-components=2

Method 2 – Back up with Deja Dup

Deja Dup is an excellent tool for those looking to create a backup on a Flash drive but don’t want to deal with the terminal. It’s an easy to use app that saves your settings in a couple of clicks.

Using the Deja Dup backup tool requires that you install the program. So, before we continue, click here to learn how to install the app. Then, once it’s up and running, plug in your flash drive.

Once the USB flash drive is plugged in, click on “Storage location” in the Deja Dup app. Then, locate the drop-down menu and click on the option labeled “local folder.”

Upon clicking on the “local folder” option, a file-browser window will appear. Use it to browse to the main folder of your flash drive. Then, click OK to add it to Deja Dup as the storage location.

Add folders to save

With the storage location set to your flash drive, it’s time to set the folder to backup. In the app, locate “Folders to save” and click on it with the mouse. Once there, click the “+” sign to bring up the file browser.

In the file browser, ensure that you have hidden folders enabled and add ~/.config/. Alternatively, if you can’t enable hidden files, or want to back up more than just the ~/.config/, feel free to add ~/ instead.

Start the backup

Backing up to a flash drive with Deja Dup is very easy. To do it, click on “Overview.” Then, find the “Back up Now” button and click on it to start the backup. Be sure to check the “encrypt” box if you’d like to keep your backup secure.

Restore the Deja Dup backup

To restore your backup from a flash drive, plug in the device to a USB port. Then, open up Deja Dup. With the Deja Dup app open on your Linux PC, click on “Storage” location.

Using the drop-down menu, configure Deja Dup to use your USB flash drive as a storage location.

After configuring the Deja Dup application to recognize your USB flash drive, make your way to the “Overview” area. Then, click on the “Restore” button to restore your configuration files to their original locations.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.