cli-tarHow do I split files and compress them using tar and gzip?
To split files and compress them using tar and gzip, you can use the following command:
tar -czvf <name_of_tar_file>.tar.gz <name_of_file_to_compress>
This command will create a <name_of_tar_file>.tar.gz file which contains the compressed version of <name_of_file_to_compress>.
Code explanation
tar- This is the command to create a tar file.-czvf- This is the set of flags for the command.-cis for creating a new tar file,-zis for compressing the file using gzip,-vis for verbose output and-fis for the file name of the tar file.<name_of_tar_file>.tar.gz- This is the name of the tar file that will be created.<name_of_file_to_compress>- This is the name of the file that will be compressed and added to the tar file.
Helpful links
More of Cli Tar
- How can I fix an unexpected end of file error when compressing a file with tar and gzip?
- How do I use gzip, tar, and zip to compress files?
- How do I use the command line to tar and zip a file?
- How do I use the Unix tar zip command?
- How do I use tar gzip with a password?
- 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 a password to compress files with Unix tar?
- How do I remove the absolute path when using the Unix tar command?
- How do I create a tar.zip file in Unix?
See more codes...