LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2011, 02:23 PM   #1
linuxguy7820
Member
 
Registered: Mar 2011
Distribution: CentOS, RHEL, Fedora
Posts: 35

Rep: Reputation: 0
Using tar to create bzip file


Hi...

Newbie question on using tar, i'm trying to use tar to create a zip file but everytime I try using the command it just dumps out to the screen... I know i'm missing something simple but darned if I can figure out what it is.

The command i'm using:

tar -cpvz archive.bz2 /directory_name/*

_thanks
 
Old 05-19-2011, 02:24 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You need to use the -f flag to specify the filename of the tar ball you want to create. In addition, if you want to compress with bzip2, then you want to use 'j', instead of 'z', which is for gzip.
 
Old 05-19-2011, 02:26 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
And some will say don't point to the man pages but clearly, the options defined in the man pages for tar would have provided you with the answers you need.

man <command>

Still don't understand or find answer, then ask away I say!
 
Old 05-19-2011, 03:02 PM   #4
linuxguy7820
Member
 
Registered: Mar 2011
Distribution: CentOS, RHEL, Fedora
Posts: 35

Original Poster
Rep: Reputation: 0
This site is really a great source of information... thanks...
 
Old 05-19-2011, 03:49 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by linuxguy7820 View Post
This site is really a great source of information... thanks...
What site?

Anyway, remember that "tar" is purely an archive format (no compression), and that bzip2 is purely a compression format (no archiving). To create a compressed archive, you would create a tar archive and then compress it with bzip2. Since this is so common, GNU tar has options to automatically compress the resulting tar archive without you having to run a compression command separately.

Last edited by MTK358; 05-19-2011 at 03:50 PM.
 
Old 05-19-2011, 09:48 PM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
Assuming you have the compression application installed, in this case bzip, I like to do:
Code:
tar acf archive.tar.bz2 <dirs or files>
The nice thing here is you can change bz2 to gz, xz, lzma or whatever and it will automagically pick the compression for you
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create file using tar and ls commands Ejdaha Linux - Newbie 2 02-16-2009 09:55 AM
tar and bzip extract from CD phenrichs Linux - Newbie 4 12-05-2007 06:44 PM
backup: dump vs tar-bzip/gzip kpachopoulos Linux - General 2 12-21-2006 07:45 AM
How to uninstall tar / bzip/bzip2 files........ emailssent Linux - Software 2 10-11-2004 02:11 AM
how to create a tar.gz file? fuelinjection Linux - General 2 07-09-2004 06:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration