![]() When compressing you can exclude specific directories or files using -exclude switch. To compress multiple files into one archive file, type: tar -czvf doc1.txt doc2.txt doc3.pdf Exclude Directory when creating Archive File The following command compress directories to an archive file named in the current directory: tar -czvf /path/to/directory1 /path/to/directory2 Compress Multiple Files You can use replace -z with -j option to compress using bzip2 algorithm. The above command will create an archive file named in the current directory. You need to use -z option for gzip and -j option for bzip2 algorithm.įor example to compress a directory named projects using gzip and save the file as, type: tar -czvf /home/foo/documents You can tell the tar command to create archive files with compression using various algorithms. This creates tar files, it is used to just bundle a bunch of files or directories Compress a Whole Directory tar -cvf move.tar file.txt file2.txt file2.txt To create an archive file without any compression using -cvf option. Let's check more into the Linux Tar command and its usage with examples. ![]() Example: tar -czvf -P /path/to/directory-or-the-file Tar Command Examples If you get a message saying "tar: Removing leading `/' from member names" it's only information you can use -P option or remove the absolute path. Tar can use different compression algorithms to create tarballs which having extensions such. Tar command is generally used to compress files and directories into a single archive. The compressed archive file or called tarballs will have extensions such as. tar archive (uncompressed) and compress it using compression algorithms such as xz, gzip, and bzip2. The tar command is used in Linux to create compressed or uncompressed archives containing a set of files or a single file. We will also go through how to extract files using the tar command. In this tutorial, we learn about tar command in Linux to create compressed or uncompressed archive files. ![]() You need to know how to unzip those files. You may have downloaded or a backup file with.
0 Comments
Leave a Reply. |