![]() ![]() To uncompress the 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 -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 z. f – File name type of the archive file.Let’s discuss each option used in the above tar command to create a tar archive file. home/tecmint/rpmforge-release-0.5.i386.rpm home/tecmint/phpmyadmin-2.11.11.noarch.rpm See the example of the tar command in action. The below example of the tar command will create a tar archive file tecmint-14-09-12.tar for a directory /home/tecmint in the current working directory. Exclude Files and Directories in Tar File How To Verify tar, tar.gz, and tar.bz2 Archive File Add Files or Directories to tar.gz and tar.bz2 Files Extract a Group of Files using Wildcard in Linux If you find this guide helpful or have more information or additional ideas, you can give me a feedback by posting a comment. That is it with extracting tar files to a specific directory and also extracting specific files from a tar file. Img 05: Extract Specific Files From Tar Archive Summary # tar -xvf etc.tar etc/issue etc/nf etc/mysql/ -C /backup/tar_extracts/ In the next example, I will extract specific files out of a tar file to a specific directory as follows: # mkdir /backup/tar_extracts The tar utility also allows you to define the files that you want to only extract from a. Img 04: Extract tar.bz2 Files to Different Directory Example 4: Extract Only Specific or Selected Files from Tar Archive # tar -jvxf documents.tbz2 -C /tmp/tar.bz2/ Now we will be unpacking the documents.tbz2 files to /tmp/tar.bz2/ directory. tbz2 Files to Different DirectoryĪgain repeating that you must create a separate directory before unpacking files: # mkdir -p /tmp/tar.bz2 tgz Files to Different Directory Example 3: Extract tar.bz2. Now we will extract the contents of documents.tgz file to separate /tmp/tgz/ directory. tgz Files to Different Directoryįirst make sure that you create the specific directory that you want to extract into by using: # mkdir -p /tmp/tgz Img 02: Extract Tar Files to Specific Directory Example 2: Extract. # tar -xvf articles.tar -directory /tmp/my_articles/ Let me also use the -directory option instead of -c for the example above. In the above example I used the -v option to monitor the progress of the tar extraction. Img 01: Extract Tar Files to Different Directory To extract the files in articles.tar to /tmp/my_article, I will run the command bellow: # tar -xvf articles.tar -C /tmp/my_article/ You can include the -p option to the above command so that the command does not complain. Let me start by creating the /tmp/my_article directory using the command below: # mkdir /tmp/my_article Always make sure that the directory into which you want to extract tar file exists. ![]() In the first example, I will extract the files in articles.tar to a directory /tmp/my_article. Example 1: Extracting tar Files to a Specific Directory ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |