LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-22-2004, 08:38 AM   #1
Cruger
LQ Newbie
 
Registered: Mar 2004
Posts: 14

Rep: Reputation: 0
Question Probably a simple solution 2 a tar question


Hi.. I'm writing a script to decompress a tar file... my code so far looks like this:

----------------------------------------------------------------------------
`tar xf filename.tar`
----------------------------------------------------------------------------

I don't get any errors.. but it does not decompress it either... why? what have I missed?
 
Old 03-22-2004, 09:42 AM   #2
mfeat
Member
 
Registered: Aug 2003
Location: Akron, OH
Distribution: Fedora Core 3
Posts: 185

Rep: Reputation: 30
if the tarfile is compressed add "z" option:

tar xfz filename.tar

it could also be compressed with bzip2 in which case use "j"

to see what type of compression was used do:
file filename.tar
 
Old 03-22-2004, 09:54 AM   #3
Cruger
LQ Newbie
 
Registered: Mar 2004
Posts: 14

Original Poster
Rep: Reputation: 0
It tells me : backup.tar: empty

why?
 
Old 03-22-2004, 02:09 PM   #4
mfeat
Member
 
Registered: Aug 2003
Location: Akron, OH
Distribution: Fedora Core 3
Posts: 185

Rep: Reputation: 30
sounds like you've not put any files in the tar, what command are you using to create the tar file?
 
Old 03-23-2004, 07:42 AM   #5
Cruger
LQ Newbie
 
Registered: Mar 2004
Posts: 14

Original Poster
Rep: Reputation: 0
This is the command I use to create the tar file... (I need to be able to add more files to this archive later, that's why I've used >>)
-----------------------------------------------------------------
`tar cf $fil.tar >> backup.tar`
-----------------------------------------------------------------
 
Old 03-23-2004, 09:18 AM   #6
mfeat
Member
 
Registered: Aug 2003
Location: Akron, OH
Distribution: Fedora Core 3
Posts: 185

Rep: Reputation: 30
you're missing the name of the file(s) or directory to add to the tar. also, use "r" instead of "c" to append

to add all files in the current directory tree do:

tar rf file.tar .

to add selected files in a dir do (c files in this example):
tar rf file.tar *.c

to view the list of files in the tar do:
tar tvf file.tar

to add another directory tree to the tar, do:
tar rf file.tar newdir
 
Old 03-23-2004, 09:32 AM   #7
Cruger
LQ Newbie
 
Registered: Mar 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Thumbs up

Oki, thanx that did the trick
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A simple DNS solution mangueJOE Linux - Networking 10 04-09-2006 12:45 AM
simple autofs solution friendly_guy Slackware 10 07-13-2005 06:40 PM
Simple Tar Question otisthegbs Linux - Software 1 08-24-2004 01:47 PM
My Simple Security Solution For Linux bjdea1 Linux - Security 10 04-02-2004 06:39 PM
I need a reliable, simple backup solution kkempter Linux - Software 1 02-05-2003 12:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration