- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- tar command ...
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
02-01-2006 08:58 AM
02-01-2006 08:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 09:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 09:05 AM
02-01-2006 09:05 AM
Re: tar command ...
cd /mysourcedir
tar cvf
where
so
cd /mysourcedir
tar cvf mysourcedir.tar .
or simply
tar cvf mysourcedir.tar /mysourcedir
would create a tar file of the contents of /mysourcedir. The first example buries the name of the directory as "." and the second buries the name of the directory as "/mysourcedir". This makes a difference when you extract the data later on.
To extract the data:
cd /mydestdir
tar xvf
would put the contents of
If you used the second method (mentioned above) to create the tar file with the absolutepath /mysourcedir embedded in the tar file, then you don't have much choice but to extract the data into /mysourcedir as well.
tar xvf
would create the directory "/mysourcedir", if it doesn't exist, and put the files from the tar file in the /mysourcedir directory.
There's more, but that's the main two commands for tar.
Of course,
"man tar" for the rest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 09:07 AM
02-01-2006 09:07 AM
Re: tar command ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 09:08 AM
02-01-2006 09:08 AM
Re: tar command ...
# tar -cvf /tmp/archive /home
..would (c)reate a (f)ile named "/tmp/archive" for the contents of the '/home' directory and (v)erbosely record to your terminal the files archived.
# tar -xvf /tmp/archive
...would e(x)tract the archive (back into '/home' since we used absolute paths (not always a good thing!)
# tar -tvf /tmp/archive
...would merely list the contents of the archive.
With 'tar' archives (whether to a tape or to a file) it is ofter better to use relative paths. Thus in our first example:
# cd /home && tar -cvf /tmp/archive .
...would allow restoration later in a directory of our choice without a great deal of bother.
See the manpages for 'tar' and its cousin 'pax'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 09:14 AM
02-01-2006 09:14 AM
Re: tar command ...
the use of tar command is same in all the flavour of unix...
tar is basically used for backup purpose.means you can take a backup of ur file by using tar..
# tar cvf < name of destination>
name of destination= /dev/rmt/0mn (device name of ur tape drive).
# tar cvf /dev/rmt/0mn /home
it will take a backup of ur home directory...
and you can view
# tar tvf /dev/rmt/0mn
and you can extract the backup
# tar xvf /dev/rmt/0mn
you can also make a archive file by using tar
tar cvf home.tar /home
i think this will solve youe doubt. see man page also..
regards
karan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 09:57 AM
02-01-2006 09:57 AM
Re: tar command ...
To create a directory (dir1) to tar file
#tar -cvf dir1.tar /dir1
To untar a tar file.
#tar xvf dir1.tar
To untar a dir1.tar.z file
#tar -zxvf dir1.tar.z
Cheers
Indrajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 01:23 PM
02-01-2006 01:23 PM
Re: tar command ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 01:29 PM
02-01-2006 01:29 PM
Re: tar command ...
Check the url (docID : KBAN00000907) about 'Example backup/recover commands for fbackup, cpio, tar' :
http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000076534352
Hope this information can help.
Cheers,
AW