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

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

To compress files in cPanel, follow these steps:

  1. Log in to your cPanel account.

  2. On the Tools page, in the Files section, click File Manager.

  3. In the left sidebar, open the folder containing the files you want to compress.

  4. Select multiple files:

    • Hold Shift to select a group of files.

    • Hold Ctrl to select individual files.

  5. Click Compress in the top menu bar.

  6. 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.

  1. Enter a name for the compressed archive.

  2. Click Compress File(s).

  3. 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

If you prefer using SSH, you can compress and decompress files directly from the command line.

  1. Log in to your account using SSH.

  2. Run one of the following commands:

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 -r option:

zip -r new.zip *

To Decompress a ZIP File

unzip new.zip

To Create a TAR File

tar cvf new.tar *

This command creates a tarball of all files and subdirectories.

Tip:
To extract a .tar file, replace c with x:

tar xvf new.tar

To Create a GZIP File

gzip test.txt

This 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

gunzip test.txt.gz

By using these methods — either through cPanel or via SSH — you can easily manage file compression on your Ruachost.com hosting account.

آیا این پاسخ به شما کمک کرد؟ 0 کاربر این را مفید یافتند (0 نظرات)

Powered by WHMCompleteSolution