Data loss can happen for many reasons including unexpected hardware failure, deleting or overwriting files accidentally, etc.

If you want to keep a copy of your home directory separately, then this article will help you back it up with an easy and quick way done via the command line under Ubuntu/Debian.

Open the Terminal and run this command to backup your home directory:

tar cvpf backup.tar `ls`

The backup file will be created in the current folder having this name and extension: backup.tar.
You can then use this command to make an incremental backup so that you ensure copying only new and modified files:

tar cvpf backup.tar -g snapshot `ls`

If you don't want to backup a specific file or folder, you can exclude it using this command:

tar cvpf backup.tar -g snapshot `ls --hide=Directory_or_file_name`

Replace "Directory_or_file_name" with the name of the directory or file you want to exclude. The backup file can be then extracted with this command:

tar -xvf backup.tar

That's it!

Post a Comment