In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to extract the tar file to different directories in the Linux system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to extract tar files to different directories in the Linux system."
You don't have to use the cd command to change to another directory and extract it. You can extract a file using the following syntax:
Grammar
Typical Unix tar syntax:
The code is as follows:
Tar-xf file.name.tar-C / path/to/directory
GNU/tar syntax:
The code is as follows:
Tar xf file.tar-C / path/to/directory
The code is as follows:
Tar xf file.tar-directory / path/to/directory
Example: extract the file to another directory
In this case. I unzip $HOME/etc.backup.tar to the / tmp/data directory. First, you need to create this directory manually by typing:
The code is as follows:
Mkdir / tmp/data
To extract $HOME/etc.backup.tar into / tmp/data, type:
The code is as follows:
Tar-xf $HOME/etc.backup.tar-C / tmp/data
To see the progress, use the-v option:
The code is as follows:
Tar-xvf $HOME/etc.backup.tar-C / tmp/data
Sample output:
Gif 01: tar command unzips the files to a different directory
You can also specify the files to be extracted:
The code is as follows:
Tar-xvf $HOME/etc.backup.tar file1 file2 file3 dir1-C / tmp/data
To extract the foo.tar.gz (.tgz extension file) package into / tmp/bar, type:
The code is as follows:
Mkdir / tmp/bar
Tar-zxvf foo.tar.gz-C / tmp/bar
To extract the foo.tar.bz2 (.tbz, .tbz2 and .tb2 extension files) package into / tmp/bar, type:
The code is as follows:
Mkdir / tmp/bar
Tar-jxvf foo.tar.bz2-C / tmp/bar
At this point, I believe you have a deeper understanding of "how to extract tar files to different directories in the Linux system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.