12/23/2023 0 Comments Apple untar commandJ is for filter to bzip2 (This filters the file through the bzip2 compression algorithm.) This command is used to extract files inside of a compressed tarball file that is using the bzip2 compression algorithm. Z is for filter to gzip (This filters the file through the gzip compression algorithm) This command is used to extract only some directories inside of a compressed tarball file that is using the gzip compression algorithm. Z is for compress (This filters the file through the compression algorithm) This command is used to extract files inside of a compressed tarball file that is using the gzip compression algorithm. V is for verbose (This switch lists the files processed by the tar command)į is for file (This switch tells tar what file or device to use) X is for extract (This switch will extract files from the tar file) To extract files from a tar file, or to get the files out of the tarball file: tar file.īelow is the syntax use to the tar command. Tape is still used, but the main point for tar files is a way to put many files into one, so they can all be downloaded. Tape media is a long strip of plastic film that has a magnetizable coating that can be edited with a use of a tape drive. One of the first uses for a tar file was to backup files to a tape media. Tarball files are used primarily in a UNIX and LINUX environments. Tarball file is just like a ZIP file, but does not compress the files inside of it. When tar is used to create a archive file, that file is called a tarball or a. tar is a abbreviation for “Tape ARchive”. To extract or untar archive file named, run the following command: tar -xzf was and is a program that creates Archive files. Doesnt matter whether it's a gzip or bzip2 tar archive use the same option.Įxample to extract tar.gz compressed file: To decompress and extract use -x option with tar command. ie The directories /etc/nginx, /var/www/html, and /var/log/nginx will be recreated in the location where you execute the extraction command. When you extract the filearchive that you created, the original directories and their content will be recreated in the directory where you perform the extraction. Remember tar maintains the directory structure when archiving, so when you extract you get a separate directory.Īnother example: tar -czf file/etc/nginx /var/www/html /var/log/nginx This compresses two directories named projectdir1 and projectdir2 into a gzip-compressed tarball named. Simply need to specify the names of the directories you want to compress as arguments to the tar command.Įxample: tar -czf projectdir1 projectdir2 Instead of compressing one whole directory, you can choose multiple directories or files. This command creates a gzip-compressed archive file named 2 of the directory named projectdir1. To create a tar archive file use -c option followed by -f option to specific filename of the archive tar -cf project.tar file1.txt file2.txt dir1Įxample: tar -cjf 2 projectdir1 Recommended Read: tar Cheat Sheet: Quick Reference Guide Creating tar archives Verbose mode, show the progress when creating the archive fileĬompress the archive using gzip compression algorithmĬompress the archive using bzip2 compression algorithmĬompress the archive using xz compression algorithmĪllows you to specify an archive filename. : The file or directory that you want to archive or extract.: The name of the archive you are creating or extracting.: The operation mode and options you want to use, like -c for create, -x for extract, -z for gzip, -v for verbose, -f for file, and many others.This could compressed or uncompressed file. The tar short for Tape Archive (.tar) is used in Linux to create archive files. This is commonly known as an archive file ( can be an uncompressed file as well). You can also create a compressed tar file typically suffixed with. A tar file always retains file structure and can preserve metadata. This best way to package multiple files or directories without compressing. A tar file, also known as a tarball, is a collection of files and directories wrapped up into one single file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |