1/1/2024 0 Comments Tar compress into directoryExcluding Specific files from being compressed In order to display a list of the content of a tar archive file, you would just need to run the command below with the option t : Tar -czvf home/dir1 home/dir1 home/dir3 home/dir4/singlefile.mp3 Listing the content of a tar archive file To compress the directories home/dir1, home/dir1, home/dir3 and home/dir4/singlefile.mp3, just issue the command below : The tar command can be used to compress multiple single files or multiple directories or a mix of both since in Linux, a directory is also a file.You would just need to provide the list of directories or files in cascade as shown in the example below : Compressing multiple directories or files -f: Enables you to specify the archive file.-z : Compresses the archive using gzip.The v, though it is optional, might come in handy. -v: Displays progress while performing the archive creation.Here’s an explanation of the switches used in the example above: How to tar a file in linux | Linux tar directory | Linux tar folder Tar -cvzf new_compressed_ net2_dmin/Downloads/ The following command will compress an entire folder net2_dmin/Downloads/ as well as its sub-folders, or in other words, it will perform a recursive compression on the whole directory : Let us first create a tar archive file for a specific directory. In the article, you will learn how to use the tar command in order to extract and create archive files, display and verify the content of a file as well as how to add directories or files to archive, etc… Creating a tar archive file The complexity stems from the many settings and options that you can use with tar. The tar command is not so straightforward to use for beginners. tgz files which are also called ‘tarballs’. The tar tool, which stands for ‘tape archive’, is one of the most important utilities for system administrators in the Unix/Linux world. One of the most commonly used commands to compress and extract files is ‘tar’.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |