Compressing files using cPanel or the command line
Compressing Files using cPanel or the Command Line
Learn how to save space and speed up file transfers by compressing files. This guide explains two methods for creating compressed files: through cPanel or directly from the command line.
Why File Compression Matters
Section titled “Why File Compression Matters”File compression allows you to store and transfer data more efficiently.
- It reduces disk space usage for files you rarely use.
- It speeds up uploads and downloads when transferring multiple files.
Common compression formats include ZIP, RAR, TAR, and GZIP. Below are step-by-step methods to create and manage compressed files on Ruachost.com.
Method 1: Using cPanel
Section titled “Method 1: Using cPanel”To compress files in cPanel, follow these steps:
-
Log in to your cPanel account.
-
On the Tools page, in the Files section, click File Manager.
-
In the left sidebar, open the folder containing the files you want to compress.
-
Select multiple files:
- Hold Shift to select a group of files.
- Hold Ctrl to select individual files.
-
Click Compress in the top menu bar.
-
In the Compress dialog box, choose a compression type (for example, ZIP).
Note:
ZIP files are best for Windows users because they can be easily opened without extra software.
- Enter a name for the compressed archive.
- Click Compress File(s).
- When the process is complete, a Compression Results window appears. Click Close to finish.
Tip:
To decompress (extract) a file in File Manager, right-click the archive and select Extract.
Method 2: Using the Command Line
Section titled “Method 2: Using the Command Line”If you prefer using SSH, you can compress and decompress files directly from the command line.
- Log in to your account using SSH.
- Run one of the following commands:
To Create a ZIP File
Section titled “To Create a ZIP File”zip new.zip *This command compresses all files in the current directory.
Tip:
To include subdirectories and their files, use the-roption:zip -r new.zip *
To Decompress a ZIP File
Section titled “To Decompress a ZIP File”unzip new.zipTo Create a TAR File
Section titled “To Create a TAR File”tar cvf new.tar *This command creates a tarball of all files and subdirectories.
Tip:
To extract a.tarfile, replacecwithx:tar xvf new.tar
To Create a GZIP File
Section titled “To Create a GZIP File”gzip test.txtThis replaces test.txt with a compressed version called test.txt.gz.
Tip:
To compress all files in the current directory and its subdirectories:gzip -r .
To Decompress a GZIP File
Section titled “To Decompress a GZIP File”gunzip test.txt.gzBy using these methods — either through cPanel or via SSH — you can easily manage file compression on your Ruachost.com hosting account.