In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Want to try not to extract a file from the tar.gz package to the specified directory, Baidu is all a template, there is no example, simply inexplicable. I can only understand it after my own test.
The method from Baidu
Tar package
Tar tvf yourtarfile | grep fileyouwant
Tar xvf yourtarfile fileyouwant (all paths above copy are absolute paths)
Tar.gz package
Tar ztvf yourtargzfile | grep fileyouwant
Tar zxvf yourtarfile fileyouwant (all paths above copy are absolute paths)
The idea is to find out the file path first, and then decompress it. But the above "full path with absolute path" is what kind of ghost, only after twists and turns to understand. Let's first look at the operation process.
[root@fengzw test] # pwd/root/test [root@fengzw test] # lsmariadb-10.4.12.tar.gz [root@fengzw test] # tar-tzvf mariadb-10.4.12.tar.gz | grep CMakeLists.txt.-rw-rw-r-- buildbot/buildbot 17932 2020-01-27 04:43 mariadb-10.4.12/CMakeLists.txt. [root@fengzw test] # tar-zxvf mariadb-10.4.12.tar.gz Mariadb-10.4.12/CMakeLists.txt-C.. / mariadb-10.4.12/CMakeLists.txt [root@fengzw test] # cd. [root@fengzw ~] # lsanaconda-ks.cfg CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Sources.repo CentOS-Vault.repo test tools [root@fengzw ~] # ls test/mariadb-10.4.12 mariadb-10.4.12.tar.gz [root@fengzw ~] # ls test/mariadb-10.4.12CMakeLists.txt
Change to a directory to run the test:
[root@fengzw ~] # ls test/mariadb-10.4.12.tar.gz [root@fengzw ~] # ls tools/testtar/ [root@fengzw] # tar-zxvf test/mariadb-10.4.12.tar.gz mariadb-10.4.12/CMakeLists.txt-C tools/testtar/mariadb-10.4.12/CMakeLists.txt [root@fengzw ~] # ls tools/testtar/ [root@fengzw ~] # ls testmariadb-10.4.12.tar.gz [root@fengzw ~ ] # lsanaconda-ks.cfg CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Sources.repo CentOS-Vault.repo mariadb-10.4.12 test tools [root@fengzw ~] # ls mariadb-10.4.12/CMakeLists.txt
From the above, we can see:
The so-called absolute path is the path found through tvf, that is, starting with the tar package name, rather than the absolute path at the system level. This is the concept of the so-called "full path". If you are extracting a file, the storage location specified by-C will not take effect! It can only be extracted by default to the current system path when tar decompression is run, not to the path of the original package. A directory starting with the name of the tar package is generated, and the extracted files are stored according to the path within the package. Use step summary: a, switch the path to the location where you need to store the extracted file; b, find the path listing the extracted file; c, extract the file. (but a new directory will be generated, so there is no point in switching to the path.)
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.