tar parameters

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users tar parameters
# 1  
Old 09-26-2001
Question 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.
# 2  
Old 09-27-2001
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.
# 3  
Old 10-21-2001
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.
# 4  
Old 10-21-2001
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
# 5  
Old 10-23-2001
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Tar - pre-checking before making the Tar file

Coming from this thread, just wondering if there is an option to check if the Tar of the files/directory will be without any file-errors without actually making the tar. Scenario: Let's say you have a directory of 20GB, but you don't have the space to make Tar file at the moment, and you want... (14 Replies)
Discussion started by: filosophizer
14 Replies

2. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

3. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

4. Shell Programming and Scripting

tar cmd how many arguments into parameters of filenames

Hi I would like to use tar cmd in my script. I have a variable with filenames, e.g. 1000 records and I would like to paste its values into tar cmd. For this example I used three elements variable strings. strings="file1.txt file2.txt file3.txt" `tar cf file1.tar $strings` Whether... (1 Reply)
Discussion started by: presul
1 Replies

5. AIX

tuning network parameters : parameters not persist after reboot

Hello, On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command. tunrestore -R is present in inittab in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log ... (0 Replies)
Discussion started by: dantares
0 Replies

6. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

7. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

8. UNIX for Advanced & Expert Users

Tar utility (untar a .tar file) on VxWorks

Hi All Can someone pls guide me if there any utility to compress file on windows & uncompress on vxworks I tried as - - compressed some folders on windows ... i created .tar ( to maintain directory structure ) and compressed to .gz format. - on VxWorks i have uncompressed it to .tar... (1 Reply)
Discussion started by: uday_01
1 Replies

9. Shell Programming and Scripting

using a vaiable parameters and values to find and tar

This one took HOURS and HOURS of my life. Hopefully this post will save someone the same grief. I am using "-regex" with "find" via a variable. If I echo the command that is constructed, it looks OK. When I paste the echoed text it to the command line it runs fine. But inside the script it... (1 Reply)
Discussion started by: jjminkle
1 Replies
Login or Register to Ask a Question