The UNIX and Linux Forums

The UNIX and 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
 
Hi,

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
Example
tar cf my.tar test1.txt test2.txt test3.txt
or
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]
or:
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 10:12 PM.

Linux and Unix Supported by: vBulletin
Search Engine Optimisation provided by DragonByte SEO v1.1.4 (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
The UNIX and Linux Forums Content Copyright ©1993-2013. All Rights Reserved.
Forum Operations by The UNIX and Linux Forums