How do I Compress a Whole Linux or UNIX Directory?

How do I Compress a Whole Linux or UNIX Directory?

To compress a whole directory under Linux or UNIX, you can use the "tar" command. "tar" is a utility that creates and manipulates tar archives, which are files that can contain multiple files and directories.

Here are the steps to compress a directory using "tar":

  1. Open a terminal and navigate to the directory that you want to compress.

  2. Type the following command to create a tar archive of the directory:

tar -cf ARCHIVE.tar DIRNAME
Source:ww‮al.w‬utturi.com

Replace "ARCHIVE.tar" with the name that you want to give to the tar archive, and "DIRNAME" with the name of the directory that you want to compress.

  1. "tar" will create a tar archive of the directory and its contents. The tar archive will be stored in the current directory with the name that you specified.

  2. To compress the tar archive using gzip, you can use the following command:

gzip ARCHIVE.tar

This will create a gzip-compressed version of the tar archive with the name "ARCHIVE.tar.gz".

With these steps, you should be able to compress a whole directory under Linux or UNIX using the "tar" and "gzip" commands.

Note: "tar" has many options and features that allow you to customize the way it creates and manipulates tar archives. Consult the "tar" documentation for more information on the available options and usage examples.

Created Time:2017-10-28 21:38:54  Author:lautturi