After the fantastic announcement of SQL Server on Linux – Public Preview, I started exploring a couple of things on SQL Server on Linux. During the exploration of SSOL, I realized that If you are a new Linux System user, you might find difficulties to zip and unzip a SQL database backup file on a Linux system. In this tutorial, we will see how we can achieve this using command line.
- Connect to your Linux machine
- Check, if the Zip software is already installed
Syntax: dpkg -s zip
- If It is not installed, let’s switch to root user to install it
Syntax: sudo -i
- Now, let’s install the Zip software
Syntax: apt-get install zip
- Locate the SQL Server database backup zipped file on your Linux machine
Syntax: ls -l
- Unzip the SQL database backup file
∗At Same location
Syntax: unzip ‘ThezippedSQLBackupfileName’ ‘ExtractedFileName’
∗At different location
Syntax: unzip ‘ThezippedSQLBackupfileName’ -d ‘NewLocationwithExtractedFileName’
Note: “-d” parameter is used to extract files into exdir
- Verify the unzipped backup file
Syntax: ls -l
- Now, Zip a SQL Server Database backup file and verify it
Syntax: zip ‘ThezippedSQLBackupfileName.zip’ ‘BackupFileName’
I hope this tutorial was helpful and also saved your a lot of time on searching how to zip and unzip SQL Server database backup file or others files on Linux machine.