The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Zipping files older than one month ramky79 Shell Programming and Scripting 2 04-07-2008 05:39 PM
tar'ing and regular expressions sirbrian UNIX for Dummies Questions & Answers 2 07-10-2007 08:17 AM
Zipping dreams5617 UNIX for Dummies Questions & Answers 1 02-11-2007 08:03 PM
Zipping the dir dreams5617 Shell Programming and Scripting 1 07-26-2006 01:20 AM
Error tar'ing files to tape FredSmith SUN Solaris 6 10-06-2005 11:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-02-2006
FredSmith FredSmith is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 88
tar'ing and zipping files

If I have a directory /directory1 and want to tar and zip everything in it into a file new_tar.tar.gz on disk (not tape)

How can I do it?

I tried tar -cv /new_tar.tar /directory1/*

But I got an error: tar: /dev/rmt/0: No such device or address
  #2 (permalink)  
Old 05-02-2006
gilmord gilmord is offline
Registered User
  
 

Join Date: May 2006
Posts: 5
I would personally never tar anything up with an 'absolute' file name as you'll never know whether you'll have permission to untar it/whether you'll overwrite someone's much needed directory.

I would do the following from directory1:
tar cvf home_directory/new_tar.tar *
  #3 (permalink)  
Old 05-02-2006
FredSmith FredSmith is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 88
Thank you, that tars them up perfectly.

To zip them, should I wait until after they're all tar'red, and then zip, or is there a way to zip as they are tar'ing?
  #4 (permalink)  
Old 05-02-2006
DR_DAVE DR_DAVE is offline
Registered User
  
 

Join Date: May 2006
Location: Sun Diego, CA
Posts: 3
Yes, you can:

tar cf - * | zip_program > tarballname.tar.gz

This is generic, so fill in where appropriate. Some compression programs need a flag to go to standard out so double check.
  #5 (permalink)  
Old 05-02-2006
amro1 amro1 is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 105
here ...

tar by the name is "tape archive" so it assumes, if "-f" option wasn't provided it tries to put file on the tape drive: /dev/rmt is a acronym of tape drive in UNIX.

So you give it "-f" option and a file name to redirect archive to file and not to tape.

Today's tar is quite improved so there's no need to use compression as a separate program. Just add "z", like "tar -cvzf". Some versions of tars take the list of parameters without "-" but normally it is required. Get "UNIX Essentials and UNIX Core" DVD or "UNIX in 24 hours" as they teach all this stuff.

Hope it helps.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0