Compressed Files rar zip tar.gz
Our servers can compress to and extract .zip, .bz2, .gz, .tar, .tar.bz2 and .tar.gz files.
Our servers will allow you to upload .rar files, but note that RAR is a closed-source software that is NOT distributed with Linux and cannot normally be extracted via shell or the File Manager in cPanel.
This article discusses the following topics.
- How to extract a file ⤵
- How to compress a file ⤵
- Commands in extracting and compressing files via SSH ⤵
The video below demonstrates how to compress and decompress files using the File Manager in your cPanel.
How to extract a file
- Log in to cPanel.
- Click on the File Manager icon.
- Select the file that you wish to extract. You can either click Extract in the top-right corner of the File Manager or right-click on the file you wish to extract.
- Enter the directory where you want to extract the files.
- Click on Extract File(s).
How to compress a file
- Log in to cPanel
- Click on the File Manager icon.
- Select the file that you wish to compress.
- Select your preferred file Compression Type.
- Enter the name of the compressed archive and click Compress File(s).
-
Once done, a dialogue box will appear showing the Compression Results.
Commands in extracting and compressing files via SSH
Before you get started, ensure that you already have set up your SSH access. If not, follow the instructions on this knowledgebase article: How Do I Get and Use SSH Access?
.zip Files
To extract:
user@server ~ $ unzip archive.zip
To compress:
user@server ~ $ zip -v zipfilename.zip file.ext
or
user@server ~ $ zip -v zipfilename.zip directory/*
.bz2 Files
To extract:
user@server ~ $ bunzip2 archive.bz2
To compress:
user@server ~ $ bzip2 file.ext
.gz files
To extract:
user@server ~ $ gzip -d archive.gz
To compress:
user@server ~ $ gzip file.ext
.tar Files
To extract:
user@server ~ $ tar -xvf archive.tar
To compress:
user@server ~ $ tar -cvf archive.tar file1.ext file2.ext directory/
.tar.bz2 Files
To extract:
user@server ~ $ tar -xvjf archive.tar.bz
To compress:
user@server ~ $ tar -cvjf file.tar.bz2 file1.ext file2.ext directory/
.tar.gz Files
To extract:
user@server ~ $ tar -xvzf archive.tar.gz
To compress:
user@server ~ $ tar -cvzf file.tar.gz file1.ext file2.ext directory/
Please note that these are the most basic forms of the commands and have many options that are possible. HostGator does not provide support for using these commands. However, to learn more about each command, you can type:
user@server ~ $ man <command>
Where <command> is the command you would like to learn more about, such as "tar" or "gzip."