When running a blog in a VPS, Dedicated Server or Cloud Server, you will need to upload and/or download something for installation or backup.
And it will make the upload or download process more fast that if you compress the files or folders first and extract them when the process is completed.
So, how to compress and extract files in a remote server? You can log in your server via SSH and check out the following command lines:
I. How to compress files or folders via SSH
For different compressed formats, you need to use different command lines:
To compress a file or folder to a zip file:
zip -r file.zip file
To compress a file (ONLY) to a bz2 file:
Bzip2 -zk file
To compress a file (ONLY) to a gz file:
gzip -c file > file.gz
By the way, you need to change the above "file" to the file name with extension (if any) you want to compress, while you can replace the following "xxx" with any keywords:
To compress one file or folder to a tar file:
tar -cvf xxx.tar file
To compress multiple files and/or folders to a tar file:
tar -cvf xxx.tar file1 file2 folder1 folder2 ...
To compress one file or folder to a tar.bz2 file:
tar -cvjf xxx.tar.bz2 file
To compress multiple files and/or folders to a tar.bz2 file:
tar -cvjf xxx.tar.bz2 file1 file2 folder1 folder2 ...
To compress one file or folder to a tar.gz file:
tar -cvzf xxx.tar.gz file
To compress multiple files and/or folders to a tar.gz file:
tar -cvzf xxx.tar.gz file1 file2 folder1 folder2 ...
II. How to extract file via SSH
To extract a file will be easier, since you don't need to worry about folders:
To extract a zip file:
To extract a bz2 file:
To extract a gz file:
gzip -d file.gz
To extract a tar file:
tar -xvf file.tar
To extract a tar.bz2 file:
tar -xvjf file.tar.bz2
To extract a tar.gz file:
tar -xvzf file.tar.gz
By the way, you need to replace the above "file"s of the compressed files with the real file names.
Besides remote servers, the above command lines are also available for a Mac OS computer with the Terminal application.