HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: tar -xf in new directory
Operating System - Linux
1832241
Members
2789
Online
110041
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2010 09:40 AM
02-10-2010 09:40 AM
tar -xf in new directory
Hi, all
Having problems tar -x archive in new directory.
I created tar file like this:
cd /source/out
tar -cvf bills.tar gm_*.zip
then copied it to new /gm/webserver dir and tried to exract all files being there, and I just realized that it remember it old source/out directory. Nothing extracted.
Tried this:
tar -C /gm/webserver/ -xvvf bills.tar
and still verbose output shows that it points to old /source/out/gm_01.zip path.
and nothing was extracted to /gm/webserver/.
What is the trick here, do I need to use any special option while creating tar -cf ?
Tx to all
Jian
Having problems tar -x archive in new directory.
I created tar file like this:
cd /source/out
tar -cvf bills.tar gm_*.zip
then copied it to new /gm/webserver dir and tried to exract all files being there, and I just realized that it remember it old source/out directory. Nothing extracted.
Tried this:
tar -C /gm/webserver/ -xvvf bills.tar
and still verbose output shows that it points to old /source/out/gm_01.zip path.
and nothing was extracted to /gm/webserver/.
What is the trick here, do I need to use any special option while creating tar -cf ?
Tx to all
Jian
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2010 12:08 PM
02-10-2010 12:08 PM
Re: tar -xf in new directory
> I just realized that it remember it old
> source/out directory. [...]
It did? I don't see why it would, _if_ you
created the "tar" archive the way you said
that you did.
tar tfv bills.tar
> What is the trick here, [...]
It should work as desired if you specify a
relative path, not an absolute path, when
you create the archive.
Relative (often good):
cd /source/out
tar cf /bills.tar gm_*.zip
Absolute (often bad):
tar cf /bills.tar /source/out/gm_*.zip
GNU "tar" also offers some options which
allow the user to modify/transform the paths
when files are extracted.
http://www.gnu.org/software/tar/manual/
http://www.gnu.org/software/tar/manual/html_node/transform.html#SEC108
> source/out directory. [...]
It did? I don't see why it would, _if_ you
created the "tar" archive the way you said
that you did.
tar tfv bills.tar
> What is the trick here, [...]
It should work as desired if you specify a
relative path, not an absolute path, when
you create the archive.
Relative (often good):
cd /source/out
tar cf /bills.tar gm_*.zip
Absolute (often bad):
tar cf /bills.tar /source/out/gm_*.zip
GNU "tar" also offers some options which
allow the user to modify/transform the paths
when files are extracted.
http://www.gnu.org/software/tar/manual/
http://www.gnu.org/software/tar/manual/html_node/transform.html#SEC108
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2010 01:30 AM
02-14-2010 01:30 AM
Re: tar -xf in new directory
>Tried this: tar -C /gm/webserver/ -xvf bills.tar
-C is what you use when creating the tarfile.
>do I need to use any special option while creating tar -cf
You either need to be in that directory as Steven said, or you can use -C:
tar -cvf bills.tar -C /source/out .
(Note: that "*" won't work because you aren't in that directory yet.)
-C is what you use when creating the tarfile.
>do I need to use any special option while creating tar -cf
You either need to be in that directory as Steven said, or you can use -C:
tar -cvf bills.tar -C /source/out .
(Note: that "*" won't work because you aren't in that directory yet.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2010 03:03 PM
02-18-2010 03:03 PM
Re: tar -xf in new directory
This is from the man page.
Archive all files and directories in directory my_project in the
current directory to a file called my_project.TAR, also in the current
directory:
tar -cvf my_project.TAR my_project
sp,
Archive all files and directories in directory my_project in the
current directory to a file called my_project.TAR, also in the current
directory:
tar -cvf my_project.TAR my_project
sp,
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP