LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-01-2005, 05:46 PM   #1
surfbass
Member
 
Registered: Dec 2004
Posts: 33

Rep: Reputation: 15
need help with tar'ing and bz2'ing a file


i read the man pages and i still cant figure it out...can somebody just got through the standard way to tar a directory and then bz2 (and .gz) it?
 
Old 06-01-2005, 05:54 PM   #2
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
I don't know about the standard way, but what I do is cd into the folder above the one I want to compress and then use the command
tar cjf $FOLDER.tar.bz2 $FOLDER
replace $FOLDER with the actual name of the folder
 
Old 06-01-2005, 05:57 PM   #3
surfbass
Member
 
Registered: Dec 2004
Posts: 33

Original Poster
Rep: Reputation: 15
thanks...helped a lot
 
Old 06-01-2005, 05:58 PM   #4
Boby
Member
 
Registered: Feb 2004
Posts: 781

Rep: Reputation: Disabled
Hello!

Pack a directory to an tar archive:
Code:
tar -cvf archive.tar directory
Pack now the the archive.tar to gz:
Code:
gzip archive.tar
You can merge this two steps and create a tar.gz archive of a directory with:
Code:
tar -cvf archive.tar directory && gzip archive.tar
Or a much faster and simply way:
Code:
tar cvfz archive.tar.gz directory
To pack a directory to a bz2 archive:
Code:
tar -cvjf archive.tar.bz2 directory
Good luck!
Boby

Last edited by Boby; 06-01-2005 at 06:11 PM.
 
Old 06-01-2005, 06:07 PM   #5
LinuxSeeker
Member
 
Registered: Feb 2004
Location: Linuxland
Distribution: Ubuntu 5.10, KUbuntu 5.10, Mandrake 10.1 - Ubuntu 5.04 (Hoary)
Posts: 346

Rep: Reputation: 30
EDIT: Sorry, I misread your message. If you have read the manual then try to play with simple, small text files to practice the additional options of tar and bzip2.

Last edited by LinuxSeeker; 06-01-2005 at 06:09 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
forrtl: severe (47): write to READONLY file, unit 5, file /dev/pts/1 terrence Programming 1 10-01-2005 11:22 PM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 04:15 AM
TAR'ing multiple directories bob_man_uk Linux - Software 3 02-03-2005 12:08 PM
Yum update complains missing file (broken dep), but file can be located. davidas Linux - Software 0 03-27-2004 10:11 PM
How to play a media file/ video file/mp3 file recorded in harddisk/cd-rom arindam Linux - Newbie 2 09-05-2003 11:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:39 AM.

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