Creating a "tarball" is a way of creating a compressed version of an entire *directory*, also known as a "compresed archive". Often we want to create a "copy" of the original directory but compressed. ### Create the Tarball You can do this in the following way: ``` tar -czvf my_directory.tar.gz my_directory ``` - `-c`: Create a new archive. - `-z`: Compress the archive using gzip. - `-v`: Verbose mode (optional, displays progress). - `-f`: Specify the filename for the tarball (`my_directory.tar.gz` in this example). - `my_directory`: The name of the directory you want to archive. ### Verify the Tarball You can list the contents of the tarball to verify its creation without extracting it. Use the following command: ``` tar -tzvf my_directory.tar.gz ``` This command will display the list of files and directories within the tarball. ### Extract (decompress) the Tarball ``` tar -xzvf my_directory.tar.gz ``` - `-x`: Extract files from the archive. - `-z`: Use gzip to decompress (since the tarball was compressed with gzip). - `-v`: Verbose mode (optional, displays progress). - `-f`: Specify the filename of the tarball (`my_directory.tar.gz` in this example). --- #### Related #programming