cli-tarHow do I use gzip and tar in Linux?
Gzip and tar are two command line tools used to compress and archive files in Linux.
To use gzip, you can run the following command:
gzip <filename>
This will compress the file and create a new file with a .gz extension.
To unzip the file, you can run the following command:
gunzip <filename.gz>
This will decompress the file and create a new file with the original filename.
To use tar, you can run the following command to create an archive:
tar -cvf <archive_name.tar> <filename1> <filename2> ...
This will create a tar archive containing the specified files.
To extract the files from the archive, you can run the following command:
tar -xvf <archive_name.tar>
This will extract the files from the archive and create new files with the original filenames.
Code explanation
gzip <filename>
: Compress a file and create a new file with a .gz extensiongunzip <filename.gz>
: Decompress a file and create a new file with the original filenametar -cvf <archive_name.tar> <filename1> <filename2> ...
: Create a tar archive containing the specified filestar -xvf <archive_name.tar>
: Extract the files from the archive and create new files with the original filenames
Helpful links
More of Cli Tar
- How do I use gzip, tar, and zip to compress files?
- How do I use the command line to tar and zip files?
- How can I use tar commands to zip a file?
- How do I use the Unix tar xvf command to extract files?
- How do I use the shell to tar and zip files?
- How do I use the Unix tar zip command?
- How do I use the command line to tar and distribute files?
- How do I use the command line to tar and zip a file?
- How do I create a tar.zip file in Unix?
- How do I use the command line to tar and zip a file?
See more codes...