Compress/Decompress Database Backup Through The Terminal In Linux/Ubuntu



Suppose you have taken the backup of the whole database and it is very huge and you want to put the backup on your system then it will take more time to download the database so we can compress the backup it will reduce the size of the database backup and then we can download it easily and can put it on our local system. Follow the steps below

Compress file through the Terminal

Step 1. Open the terminal.
Step 2. Login through the SSH

ssh {user_name}@{host_name}

Step 3. Press Enter then it will ask for the Password after entering the Password you will be logged in.

Step 4. Navigate to the folder where is the backup file is and run this command

tar -cvzf {filename_after_zip}.tgz {actual_file_name}

Press Enter then it will compress the database backup in the tgz format.

Decompress the file through the Terminal

Step 1. Open the terminal.
Step 2. Login through the SSH

ssh {user_name}@{host_name}

Step 3. Press Enter then it will ask for the Password after entering the Password you will be logged in.

Step 4. Navigate to the folder where is the backup file is and run this command

tar xvf {filename}.tgz

Press the enter then it will decompress the file.

Hope this will help to someone.