22halomedia

How to Backup Home Folder on Linux With Tar

Subscribe to 22halomedia YouTube Channel

Introduction

Creating regular backups is always a wise decision and considered best practice. In this guide you will learn how to backup your home directory on Linux using the tar utility. Your home directory is where all your user’s files are. Typically the most important data will be found here.

Go to Your Home Directory

Use the below command to go to your home directory:

cd ~

Create Backup Directory

Before backing up your home directory you should have a good idea where you want to store your archived files. For the purposes of this guide, we will create a Backups directory in the home directory.

Make the Backups directory:

mkdir ~/Backups

Print Absolute Path of Home Directory

The absolute path of the home directory in this guide is /home/me.

Use the following command to print your home directory:

pwd

Backup Your Home Directory

Backup your home directory now that you know its absolute path:

tar -czxf /home/Backups/backup.tar.gz /home/me

Tar Flags Explained

The -c flag tells tar to create a new archive.

The -z flag directs tar to use gzip, which has the extension tar.gz

The -v flag instructs tar to use verbose output. This means when tar is ran it will output each file added to the archive to the terminal.

The -f flag specifies the file to use for the archive.

Conclusion

It is important to take regular backups to prevent data loss. Additionally, its a good idea to store these backups in several different places. For instance, an external drive and cloud storage (rather than just one).

I hope you enjoyed this article. If it helped you, please leave a comment!

Articles to Read Next

How to Setup WireGuard VPN on Rocky 9 Linux

Secure Remote Support on LAN with x11vnc over SSH on Rocky Linux

How to Install Virtual Box and Answering “What is a Hypervisor?”

How to Enable Bidirectional Shared Clipboard on VirtualBox VM

How to Create a Linux VM with VirtualBox

Affiliate Links

Form your business with Northwest registered agent

Create a website with namedotcom

Secure your website with Wordfence

My work laptop

Affiliate Disclaimer

Please note that my website and content may contain affiliate links. This means that when you click on these links and make a purchase, I may earn a commission. Rest assured, all the products I promote are ones that I believe to be of high quality, and I personally use them as a consumer myself. Your support through these links helps me continue to create valuable content. Thank you for your support!

Comments

Leave a Reply

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