Commands.page Logo

Create Compressed Backup of /etc Directory in Ubuntu

This guide outlines the precise method for securing Ubuntu system configurations by generating a compressed archive of the essential /etc directory. It details the specific terminal command required to execute this backup efficiently and explains the necessary flags to ensure data integrity and storage optimization.

To create a compressed backup of the /etc directory, open your terminal and execute the following command:

sudo tar czvf etc-backup.tar.gz /etc

This command utilizes the tar utility combined with gzip compression. The c flag creates a new archive, while z compresses the data using gzip to save space. The v flag enables verbose output to track progress, and f specifies the filename for the resulting backup. You must run this with sudo because the /etc directory contains system files that require root privileges to read. Always store the resulting etc-backup.tar.gz file on a separate drive or cloud storage to ensure recovery is possible during a system failure.