Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > tar not working

tar not working
Thread Tools
opsotta
Forum Regular
Join Date: Jan 2001
Location: Arkintoofle Minor
Status: Offline
Reply With Quote
Jun 22, 2002, 07:20 AM
 
When I just enter "tar" I will get "tar: Failed open to read on /dev/nrst0 <No such file or directory>"
When I try to create an archive, I will get the same error message, but with a write error.
How do you use tar in the CLI?

You live and learn. At any rate, you live.
     
goatnet
Dedicated MacNNer
Join Date: Jan 2002
Location: Massachoosetts
Status: Offline
Reply With Quote
Jun 22, 2002, 07:50 AM
 
You can look up the command syntax by just doing a "man tar" at the shell prompt, but to simplify it here it is:

tar -c to create an archive
tar -x extracts an archive

Example: tar -cvzf this-will-be-my-archive-name.tgz files-I-want-compressed

The -cvzf flags equal: create archive, verbose output, zip archive (gzip actually), force compression.

To extract: tar -xvzf file-I-want-uncompressed.tar.gz (or *.tgz)

Which extracts, verbosely, the gzipped archive (-f flag is for the gzip).

At least, that's the way I do it <img border="0" title="" alt="[Wink]" src="wink.gif" />


They laughed at my Mac, it had no CLI. They laughed at Linux, it had no GUI. I installed MacOS X, and shut them up.
     
howardm4
Senior User
Join Date: Sep 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jun 22, 2002, 09:26 AM
 
The tar command, without the 'f' (file) option, defaults to it's compiled
in default of /dev/nrst0 (nonrewinding scsi tape 0).

if you're going to use it to create .tar.gz type of 'tarballs', you
have to use the 'f' option as the other person pointed out.
     
Kristoff
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Jun 22, 2002, 11:14 PM
 
Also, I recommend using gnutar instead.
Tar messes up long filenames.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
opsotta  (op)
Forum Regular
Join Date: Jan 2001
Location: Arkintoofle Minor
Status: Offline
Reply With Quote
Jun 23, 2002, 04:14 AM
 
Yes, it is working with the f -flag.
But it seems to matter in what order I specify the flags:

tar -cfv test1.tgz 1500 ant.mpg
produces an archive with the name v and complains that it couldn't find 1500 nor test1.tgz, while

tar -cvzf test1.tgz 1500 ant.mpg
produced an archive with the name test1.tgz and still didn't slice them every 1500 blocks.

It's a pity there are no examples for tar in the man command. And the same man page displays
for the gnutar.

You live and learn. At any rate, you live.
     
howardm4
Senior User
Join Date: Sep 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Jun 23, 2002, 06:52 AM
 
-f archive Filename where the archive is stored. Defaults to
/dev/rst0

The options to tar are position dependent.

If you give -f, the next token on the line must be the filename.
If you give -b, the next token must be the blocking factor.
     
[APi]TheMan
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jun 24, 2002, 01:57 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by howardm4:
<strong>-f archive Filename where the archive is stored. Defaults to
/dev/rst0

The options to tar are position dependent.

If you give -f, the next token on the line must be the filename.
If you give -b, the next token must be the blocking factor.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">You can separate the flags to make it more simple... Example:

tar -c -f test1.tgz -b 1500 /file/to/be/tarred

You can split each flag up and have each flags parameters directly following the flag, that way it's easier to read and follow.

<small>[ 06-24-2002, 02:01 PM: Message edited by: [APi]TheMan ]</small>
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 12:39 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,