![]() ![]() Sometimes it is needed just to check the contents of a tarball without unpacking it.įor example, it goes without saying, that it is inadvisable to untar the whole large archive if you need for example to extract only a dingle file or a directory from it.Īnd of course this is possible with the Linux tar command, but firstly you need to check what is there inside the tarball without unpacking it. List the Contents of a tar, tar.gz, tar.bz2 Files File extensionĬool Tip: No more wasted time! Download from the web and untar in one step from the Linux command line! Read more → Untar tar, tar.gz, tar.bx2 FilesĮxtract and uncompress a tar.gz file: $ tar -xvzf Įxtract and uncompress a tar.bz2 file: $ tar -xvjf 2 Optionĭecompress the contents of the compressed archive created by gzip program ( tar.gz)ĭecompress the contents of the compressed archive created by bzip2 program ( tar.bz2) You will learn how to list the contents of a tar archive without unpacking it and how to extract only a single file or a single directory. The following article will help you to extract (unpack) and uncompress (untar) – tar, tar.gz and tar.bz2 files from the Linux command line. If you liked this post about the ten useful tar commands in Linux with examples, please share it with your friends on social networks or simply leave a reply below.Most of the Linux files that can be downloaded from the Internet are compressed with a tar, tar.gz and tar.bz2 compression formats and it is important to know how to extract such files. Also, we are available 24/7, and you can contact us anytime you want. All you need to do is to sign up for one of our NVMe VPS hosting plans. If you have difficulties using these commands and need to compress or extract some files, just submit a support ticket, and our admins will help you immediately. We showed you some useful tar commands in Linux with examples. If you want to know more about the tar command, just execute the man tar command in your terminal, and you will get the output like this: :~# man tar There are plenty of tar commands used on a daily basis by system administrators. Tar -xvf wordpress.tar wordpress/index.php To untar the single file index.php from Tar.gz, Tar, and Tar.bz2 archived files execute the following commands respectively: tar -xvf wordpress/index.php ![]() Option v is for progress and is up to you if you want to use it or not. Execute the following commands one by one to extract previously archived files. To extract the tar, tar.gz, and tar.bz2 archived files, you need to use option x. Uncompress Tar.gz, Tar, and Tar.bz2 Archived Files To see the files in the compressed tar.bz2 archived file execute the following command: tar -tf 2 8. List the content of Tar.bz2 Archived File To see the files in the compressed tar archived file, execute the following command: tar -tf wordpress.tar 7. The option t in this command is for listing the content. To see the files in the compressed tar.gz archive file, execute the following command: tar -tf This is because we used the j option for highly compressed tar files. Now, lets check the sizes of each compressed file: 62M wordpress.tarĪs you can see, the 2 has the smallest size. This will create a tar.bz2 archive file with highly compressed files in it. To create a tar.bz2 archive file, execute the following command: tar cvfj 2 wordpress/ This will make a new file, defined with the c option, and the file name type specified with the f option. To create an archive file, execute the following command: tar -cf wordpress.tar wordpress/ ![]() This will create gzip compressed file specified with the z option and the v option to show the progress while the file is being zipped. To create a tar.gz archive file, execute the following command: tar -cvzf wordpress/ The tar command have the following syntax: tar 2. Once the system is updated, we are ready to show you the tar commands in Linux with examples. If you have a fresh installation of Ubuntu 22.04, it is recommended to update the system packages to the latest versions available.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |