Operating System - HP-UX
1838430 Members
3397 Online
110126 Solutions
New Discussion

Re: how to use tar command?

 
public
Regular Advisor

how to use tar command?

I am confiuse of using tar command when saving data into my tape, does any ony can give me a General Example? TKS
8 REPLIES 8
Patrick Wallek
Honored Contributor

Re: how to use tar command?

Well, the man pages are usually very good sources of information.

# man tar

Example: If you want to store the contents of /dir1 onto tape with relative path and your tape is /dev/rmt/0m

# cd /
# tar -cvf /dev/rmt/0m ./dir1

or

# cd /dir1
# tar -cvf /dev/rmt/0m .

There is a space AFTER the 0m and before the . in each command above.

Bharat Katkar
Honored Contributor

Re: how to use tar command?

Hi,

# tar cvf <..> <..>

Hope that calrifies.
Regards,
You need to know a lot to actually know how little you know
Hoang Chi Cong_1
Honored Contributor

Re: how to use tar command?

simply, you can see in the man page:
man tar
Can go to this link:
http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90690/B2355-90690_top.html&con=/hpux/onlinedocs/B2355-90690/00/01/148-con.html&toc=/hpux/onlinedocs/B2355-90690/00/01/148-toc.html&searchterms=tar&queryid=20041031-205509
It will show you how to use and give you some example.
For example: to backup my home directory to tape (ioscan -fnC tape)
# tar -cvf /dev/rmt/0m /usr/home/jimkery

Hope this helps
Jimkery
Looking for a special chance.......
eran maor
Honored Contributor

Re: how to use tar command?

Hi

the guide line for using tar :

tar cvf - to backup files to a tar or to a tape

tar xvf - to extract files

tar tvf - to see that files in the tar file.

use this and every time that you dont know how to put the direcotry or get confuse open the man pages on tar .

eran
love computers
Deoncia Grayson_1
Honored Contributor

Re: how to use tar command?

Examples of using tar to backup to tape.

Man tar - get more information about the tar command

tar cvf /dev/rmt/0m (tape device) /etc


If no one ever took risks, Michelangelo would have painted the Sistine floor. -Neil Simon
twang
Honored Contributor

Re: how to use tar command?

To do an ENTIRE backup:
# tar cvf /dev/rmt/0m /

To store a particular directory:
# tar cv /tmp ( for default device )
# tar cvf /dev/rmt/1m /tmp (specify device)

To recover a particular directory:
# tar xvf /dev/rmt/0m /tmp

To see what's actually on the tape without restoring or extracting:
# tar tvf /dev/rmt/0m

To recover a particular FILE:
# tar xvf /dev/rmt/1m /path/filename (will only recover full path)

Sยภเl Kย๓คг
Respected Contributor

Re: how to use tar command?

tar -cvf is to write data on to the Tape
tar -tvf is to diplay the content of the tape
tar -xvf is to extract the tape contents

further clarifications see man page of tar

regards
SK
Your imagination is the preview of your life's coming attractions
Isaac Loven_4
Advisor

Re: how to use tar command?

Please assign points as a way of thanking everybody who takes the time to help you.