If we would like to untar in different directories, just use option -C and the directory path, as shown in the above example. To Uncompress tar.gz archive file, just run the following command. ![]() home/public_html/videos/all_categories.php # Untar files in Current Directory # tar -xvf public_html-14-09-12.tar # Untar files in specified Directory # tar -xvf public_html-14-09-12.tar -C /home/public_html/videos/ If you want to untar in a different directory then use option as -C ( specified directory). For example, the below command will untar the file public_html-14-09-12.tar in the present working directory. To untar or extract a tar file, just issue the following command using option x ( extract). ( Note: tar.bz2 and tbz is similar to tb2). The following example command will create a 2 file for a directory /home/php. To create a highly compressed tar file we use the option j. The bz2 compression takes more time to compress and decompress files than gzip, which takes less time. The bz2 feature compresses and creates an archive file less than the size of the gzip. home/MyImages/yanaguptabaresf231110.jpg 3. home/MyImages/ReesewitherspoonCIA101202.jpg home/MyImages/the-japanese-wife-press-conference.jpg home/MyImages/katrinabarbiedoll231110.jpg home/MyImages/RobertKristenviolent101201.jpg home/MyImages/Sara-Khan-and-model-Priyanka-Shah.jpg # tar cvzf MyImages-14-09-12.tgz /home/MyImages ( Note: tar.gz and tgz both are similar). For example, the below command will create a compressed file for the directory /home/MyImages. To create a compressed gzip archive file we use the option as z. f – File name type of the archive file.Let’s discuss each option used in the above command to create a tar archive file. home/tecmint/rpmforge-release-0.5.i386.rpm home/tecmint/phpmyadmin-2.11.11.noarch.rpm The below example command will create a tar archive file tecmint-14-09-12.tar for a directory /home/tecmint in the current working directory. wc command will count the bytes and provide estimated size of the given archived file.The main purpose of this guide is to provide various tar command examples that might be helpful for you to understand and become an expert in tar archive manipulation. We will tar the directory in to the starndard output which will be redirected to the wc command. In this example we will add file named test.txtinto the existing archive named $ tar rvfz test.txtīefore archiving a directory with tar command we can learn the size of the archive with the help of wc command. We can use r option to add new file or folder by specifying file and folder names at the end of the command like below. $ export alias untar="tar dvf $1" Untar Command Adding File into ArchiveĪfter creating an archive we may need to update or add new files and folders to the existing archive. We can create some alias to create new untar command like below. *.txt is the file names we want to exract.$ tar xvfz -wildcards *.txtĭymerge/vbscan/reports//_report_at_4.56.1.txt dymerge/surnames.txt is the file we want to extract. ![]() is our archive that contains our single file.x is the parameter to be used for this operation $ tar xvfz dymerge/surnames.txt With tar a single file can be extracted from archive. If the archive is bzip2 we can use following command $ tar tvfj Extract Single File From Archive As we see tar.gz is extension for tarred and gzipped files. But if the archive is gzip we should provide z too. We can list files without opening the tar. To compress with bzip2 j parameter should be provided. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |