UNIX & Linux Forums

UNIX & Linux Forums (http://www.unix.com/index.php)
-   UNIX for Advanced & Expert Users (http://www.unix.com/unix-for-advanced-and-expert-users/)
-   -   tar parameters (http://www.unix.com/unix-for-advanced-and-expert-users/2327-tar-parameters.html)

kmar 09-26-2001 01:07 PM

tar parameters

I'm not a very experienced in unix and I need some help. I'm trying to figure out what tar parameters to use to store a directory structure and the files within this directory structure. I also need to know how to extract this tar file from one unix machine to another unix machine.

If anyone can help, this would be great. Thanks.

LivinFree 09-27-2001 02:12 AM

My best recommendation is to read the manual page for it. Type this:
man tar

If you need more help, feel free to post back.

TioTony 10-21-2001 01:54 AM

It too recommend the man pages, or perhaps even a Unix book. But these are the baics:

To create the tar file:
tar cf <tar file name> <file1> <file2> <file3> etc
tar cf my.tar test1.txt test2.txt test3.txt
tar cf my.tar test*
Wild cards can be used with tar if you didn't know.

To see what is in the tar file

tar tvf <tar file name>

To extract the tar file
tar xvf my.tar

These are the basics. You may need to use other options depending on what you want to accomplish. If you just want to tar up a directory on one system and extract it on another, you could do this:

tar cf my.tar <directory>
this command should be run from one directory above the directory you are putting in the tar. If you do an ls, you will see the directory listed.
ftp my.tar (in binary) to the other system and put it in the directory you would like it to be under when you extract it then run:
tar xf my.tar

Hope this helps a little.

eNTer 10-21-2001 11:19 AM

There is an useful info which you might want to use. If your tar-red file is also gziped you must supply the "-z" parameter:
cd /[dir_to_extract]
tar -xzvf [file.tar.gz]will extract all files in archive into [dir_to_extract]
cd [directory]
tar -zcvf [archive_name] *
will create the archive which will finally contain all the files in diectory, including subdirs

LivinFree 10-23-2001 03:03 AM

That assumes you have gzip and the GNU tar utility installed on your system. With Linux and Hurd, this is nearly always the case. On other systems (HP-UX, SysV, etc...) it is not this way unless you install it.

All times are GMT -4. The time now is 03:53 AM.

UNIX and Linux Forums
Search Engine Optimisation provided by DragonByte SEO v2.0.32 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Unix & Linux Forums Content Copyright©1993-2017. All Rights Reserved.
Forum Operations by The UNIX and Linux Forums