In this tutorial we will see how to use the terminal to backup our system files and folders in a single compressed archive file (we will use the bz2 format). The command we are going to use will exclude some unnecessary folders from the backup process. Making a full backup of your system files and folders will allow you to recover them later in case of any unexpected system troubles.

Getting Started

The archive file that we are going to create will be stored in the "backup" folder that we will see how to create inside the home directory, you can specify any other location of your choice.

Under Ubuntu, Open the terminal (Ctrl+Alt+T) and run this command to create the backup folder we want to store the backup file:

mkdir ~/backup && cd ~/backup

Then start your system backup with this command:

tar cvpjf backup.tar.bz2 --exclude=/proc4 --exclude=/mnt --exclude=/sys / --exclude=/lost+found --exclude=/tmp --exclude=/backup.tar.bz2

If you want to exclude more folders, you can add this option followed by the folder full path in the end of the command given above as follows:


 You can browse the folder containing the backup archive file with this command:

nautilus ~/backup

You can then recover with this command:

tar xvpfj backup.tar.bz2 -C /

or run this command (full path indicated):

tar xvpfj ~/backup/backup.tar.bz2 -C /

That's it!

Post a Comment