When I did a tar -cvf, a full path was used. Now I want to set tar -xvf to a different directory. What is the command? Go to the directory where you would like to extract tar -xvf. Being in that directory just extract by giving the fully qualified path where you created tar -cvf tar file. For instance:. Now you want to extract this foo. Then follow:. If you did not use. Now I want to tar -xvf to a different directory, is there anyone know what is the command?
No redistribution. They showed the US reps — a pencil. Your only resource is to restore the file on a diferent machine, perhaps a Linux one. In the linux gnu implementation of tar, there is a flag to bypass the path. You have to tar -cvf with. Then you can tar -xvf anywhere and it will be created wherever you are at. This is how I copy directories from another directory. Thank you Kenneth and Leroy! It worked. I thought there might be other way to do it other than this.
I tried this way, it works. I hardly watch movies but love to read tech related books and articles. So, what is a tar file? A tar file is a collection of many files into one file. Tar Tape Archive is a program that collects the files and grabs some helpful information about files it archives, such as permissions, dates, etc. As a Linux administrator, you often have to deal with tar files. In many situations, you have to extract the data of a tar file to some specific directory.
This works pretty well everywhere - including Solaris, and as you only change directory in a sub-shell, it doesn't affect your location in the current session:.
Note that the Solaris tar does not understand the --directory option. See the Solaris tar manpage. Just for the sake of completeness if you have Gnu-Tar which is available for Solaris too you can use this simpler command which unzips and unpacks in one go :. On a side note: many people use a leading dash for the tar command parameters. That is redundant.
See the answers to this question if you are interested. The -xf part of tar means to extract into the "f" file. The -C option tells tar to change directory then do the extract.
How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.
0コメント