- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to extract files into a perticular directory f...
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
08-05-2004 09:58 PM
08-05-2004 09:58 PM
How to extract files into a perticular directory from a tar file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:04 PM
08-05-2004 10:04 PM
Re: How to extract files into a perticular directory from a tar file
tar xvf backup.tar
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:04 PM
08-05-2004 10:04 PM
Re: How to extract files into a perticular directory from a tar file
Go to the directory where you want to extract
the tar file &
use:
#tar -xvf file.tar
where file.tar is present in that directory.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:06 PM
08-05-2004 10:06 PM
Re: How to extract files into a perticular directory from a tar file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:09 PM
08-05-2004 10:09 PM
Re: How to extract files into a perticular directory from a tar file
assume that your tar file is /tmp/a.tar
you need to extract that in directory /usr/ravi
#mkdir /usr/ravi
#cd /usr/ravi
#tar xvf /tmp/a.tar .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:17 PM
08-05-2004 10:17 PM
Re: How to extract files into a perticular directory from a tar file
-C directory causes tar to perform a chdir() to directory (see chdir(2)). Subsequent file and -C directory arguments are relative to directory. This allows multiple
directories not related by a close or common parent to be archived using short relative path names.
However I couldn't succeed in using this. I am trying.
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:18 PM
08-05-2004 10:18 PM
Re: How to extract files into a perticular directory from a tar file
tar with -C option is used to do operation on a file located in another directory and make tar operations on that directory with going to that.
pwd /
tar file is located over /home/test/test.tar
then,
[/] tar -C /home/test -xvf /home/test/test.tar
It will archieve files over at /home/test/test directory
This operation is same to hp-ux and linux too.
Regards
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:25 PM
08-05-2004 10:25 PM
Re: How to extract files into a perticular directory from a tar file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:28 PM
08-05-2004 10:28 PM
Re: How to extract files into a perticular directory from a tar file
Please cd into the directory and do the 'tar -xvf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2004 10:47 PM
08-05-2004 10:47 PM
Re: How to extract files into a perticular directory from a tar file
tar: You must specify one of the `-Acdtrux' options
Try `tar --help' for more information.
-C is used to change the directory, as
-C, --directory=DIR change to directory DIR
So it is used to reduce to change directory to operate the tar.
It is same as,
cd /home/test;tar xvf test.tar
tar -C /home/test -xvf /home/test/test.tar
Regards
Muthukumar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2004 06:10 PM
08-08-2004 06:10 PM
Re: How to extract files into a perticular directory from a tar file
the hpux tar man page describes the -C option as useful only during creation of the tar file. but beware, it does not guarantee that relative pathnames will be used.
i dont know if you could use the chroot(1m) command (/usr/sbin/chroot) to achieve this. i tried and failed, but maybe i made some mistake.
for your case, a workaround is to untar with -C on a linux box and re-archive with *relative pathnames*.
the long-term solution would be to
- make sure you (or the vendor) create the archive with relative pathnames.
- file an enhancement request on hpux tar
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 08:53 AM
08-09-2004 08:53 AM
Re: How to extract files into a perticular directory from a tar file
% tar cvf group.tar /etc/group
a /etc/group 1 blocks
% pax -s@/@./@ -vrf group.tar
USTAR format archive
./etc/group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2004 02:45 PM
08-09-2004 02:45 PM
Re: How to extract files into a perticular directory from a tar file
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2004 01:01 AM
08-10-2004 01:01 AM
Re: How to extract files into a perticular directory from a tar file
if the files tared in tar file start are absolute path you can use the chroot following these steps
mkdir /tmp/test_tar
cp /sbin/tar /tmp/test_tar
cp tarfile.tar /tmp/test_tar
chroot /tmp/test_tar ./tar xvf tarfile.tar
If you copy the /usr/bin/tar instead of the /sbin/tar remember this file is dynamically linked, so you will need also shared library (.sl). In this case last command above would generate an error like
cannot find /usr/lib/dl.sl
copy the missing file to /tmp/test_tar/usr/lib and rerun, then copy the new file missing until u get all the required files
The idea is to recreate a minimum structure down the directory /tmp/test_tar
hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2004 01:09 AM
08-10-2004 01:09 AM