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
11-27-2008 04:39 AM
11-27-2008 04:39 AM
i created two files in /home directory as 1 2.
after that i create one directory as a. Iam trying to restore the files in a directory.
tar cvf files.tar 1 2 a
cd a
tar xvf files.tar a
It gives the error like
tar: files.tar: No such file or directory
Please help me.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 04:48 AM
11-27-2008 04:48 AM
Re: tar
Dear Anjaneyulu,
where you are going take a backup for using tar.
for examble u use the below method.
login to the home directory.
cd /home
home> tar -cvf files.tar 1 2 a
it's stored in the same home directory.like files.tar and remove it the exitsting directory.
then,
home> tar -xvf files.tar a
it will restore the mentioned directory.
u try this and revert back.....
Regards,
Unixguy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 04:48 AM
11-27-2008 04:48 AM
Re: tar
here the steps to follow.
tar options (destination) (source)
#tar cvf file.tar 1 2
#cd a
#tar xvf file.tar .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:02 AM
11-27-2008 05:02 AM
Re: tar
But it shows same error.
I want to copy the files from /home/anji to a1 directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:05 AM
11-27-2008 05:05 AM
Re: tar
> It gives the error like
> tar: files.tar: No such file or directory
After you did 'cd a'. you don't have to again specify 'tar xvf file.tar a'. Just specify 'tar xvf files.tar' (inside 'a' dir)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:11 AM
11-27-2008 05:11 AM
Re: tar
tar: file.tar: No such file or directory
It gives above error in dirctory a.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:12 AM
11-27-2008 05:12 AM
Solution>>>I want to copy the files from /home/anji to a1 directory<<
First copy all the files from /home/anji and stored in /tmp/anji.tar
#tar -cvf /tmp/anji.tar /home/anji
Now goto the directory wherever you want to restore. Then extract the file.
#cd /tmp/a
#tar -xvf /tmp/anji.tar
It will restore all the files in /tmp/a directory.
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:13 AM
11-27-2008 05:13 AM
Re: tar
Hi Anjaneyulu,
Better u login to that directory.
cd /home/anji
home/anji> tar * files.tar
then that a1 directory is in home,login into a1.
home/anji>cp files.tar /home/a1
cd ..
cd a1
home/a1> tar -xvf files.tar
Hope now u r understood.
Regards,
Unixguy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:18 AM
11-27-2008 05:18 AM
Re: tar
don't cd to a directory
cd to previous directory from where you taken the tar files and run command
#tar xvf files.tar a/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:19 AM
11-27-2008 05:19 AM
Re: tar
tar cvf files.tar 1 2 a
cd a
tar xvf ../files.tar a
Since you create "files.tar" in the local directory and then do "cd" to a subdirectory, you have to go to the directory above to find your tar file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:21 AM
11-27-2008 05:21 AM
Re: tar
> tar cvf files.tar 1 2 a
As 'a' is the destination directory, that should not be specified during 'archival'
Example:
# ls
a.c a.out a1 a1.c a2 a2.c aa.c test
# tar -cvf a.tar a.c a1.c
a a.c 4 blocks
a a1.c 2 blocks
# mkdir xyz
# ls xyz
# mv a.tar xyz
# cd xyz
# tar -xvf a.tar
x a.c, 1631 bytes, 4 tape blocks
x a1.c, 781 bytes, 2 tape blocks
# ls
a.c a.tar a1.c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 05:34 AM
11-27-2008 05:34 AM
Re: tar
'tar cvf files.tar 1 2'
'mv files.tar a'
'cd a'
'tar xvf files.tar'
OR simply:
'mv 1 a'
'mv 2 a'
'cd a'
OR
'tar cvf a/files.tar 1 2'
'cd a'
'tar xvf files.tar'
HTH
Volkmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 06:01 AM
11-27-2008 06:01 AM
Re: tar
Pls try to understand the below ex.
1)tar - cvf /tmp/file.tar /home/pr/A/*
suppose i m going to diff directory
cd /home/qt
and run the below command
tar - xvf /tmp/file.tar
it will extarct the file in /home/xospnw01/A
============================================
now second example
cd /home/pr/A
tar - cvf /tmp/file.tar ./*
cd /home/qt
tar -xvf /tmp/file.tar
it will extact the file in /home/qt
==============================
If u r using the absolute path for doing the tar then u can extarct in the same path only.
=================================
if u r using relatve path for taring then u can exatrct in any path.
Hope u will underastand the concept
Reagrds
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 06:53 AM
11-27-2008 06:53 AM
Re: tar
> a1 directory
Why didn't you say so at the beginning?
mkdir a # If needed.
( cd /home/anji ; tar cf - . ) | \
( cd a ; tar xf - )
There's no real need to create a "files.tar".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2008 07:41 AM
11-27-2008 07:41 AM
Re: tar
small correction here
1)tar - cvf /tmp/file.tar /home/pr/A/*
suppose i m going to diff directory
cd /home/qt
and run the below command
tar - xvf /tmp/file.tar
it will extarct the file in /home/pr/A
RegARDS
pRASHANT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2008 10:21 AM
11-28-2008 10:21 AM
Re: tar
and, of course, an example of that solution can be found in "man tar", had the original poster read it.