Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 06-01-2005, 04:46 PM   #1
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, 04: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, 04:57 PM   #3
Registered: Dec 2004
Posts: 33

Original Poster
Rep: Reputation: 15
thanks...helped a lot
Old 06-01-2005, 04:58 PM   #4
Registered: Feb 2004
Location: Sighisoara/Cluj-Napoca (Romania)
Distribution: CentOS 4, Fedora Core 6
Posts: 781

Rep: Reputation: 32

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

Last edited by Boby; 06-01-2005 at 05:11 PM.
Old 06-01-2005, 05:07 PM   #5
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 05:09 PM.


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 10: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 03:15 AM
TAR'ing multiple directories bob_man_uk Linux - Software 3 02-03-2005 11:08 AM
Yum update complains missing file (broken dep), but file can be located. davidas Linux - Software 0 03-27-2004 09:11 PM
How to play a media file/ video file/mp3 file recorded in harddisk/cd-rom arindam Linux - Newbie 2 09-05-2003 10:31 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:50 AM.

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