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-15-2011, 03:49 PM   #1
davedpss
LQ Newbie
 
Registered: May 2011
Posts: 15

Rep: Reputation: 0
tar multiple directories into one file


I have found ways to tar a directory and exclude certain directories but is there a way to simply tar multiple directories (they are in the same directory) in to one .tgz file? thx.
 
Old 05-15-2011, 04:35 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,183

Rep: Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505Reputation: 2505
see:
Code:
man tar
 
1 members found this post helpful.
Old 05-15-2011, 04:38 PM   #3
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello davedpss,

Code:
tar cf directories.tar dir1 dir2 dir3
will tar the directories dir1, dir2 and dir3 into an archive named directories.tar.

Markus
 
1 members found this post helpful.
Old 05-15-2011, 04:44 PM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
It depends on what you want to do.

tar -cvf tarfile.tar dir1 dir2 dir3

tar -cvf tarfile.tar *

tar -cvf tarfile.tar -T filename_where_files_are_listed

man tar
 
1 members found this post helpful.
Old 05-15-2011, 07:02 PM   #5
davedpss
LQ Newbie
 
Registered: May 2011
Posts: 15

Original Poster
Rep: Reputation: 0
I don't know how I missed this. I thought I had tried that and didn't get the result I was expecting. Obviously I was wrong. I should have suspected something when I didn't see a post on this when I searched this forum. Maybe the next person to search on this will appreciate that I asked the obvious question and get his question answered.

For the guy who simply answered "man tar" why bother? You feel better?

Thanks to those that answered the question.
 
Old 05-15-2011, 08:08 PM   #6
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 davedpss View Post
For the guy who simply answered "man tar" why bother? You feel better?
What's wrong with that answer? There are many newbies who don't know about man.

Anyway, since the issue is solved, you should mark the thread as solved now.
 
Old 05-15-2011, 09:43 PM   #7
NirvanaII
Member
 
Registered: Jun 2005
Posts: 139

Rep: Reputation: 18
Quote:
Originally Posted by MTK358 View Post
What's wrong with that answer? There are many newbies who don't know about man.
That might well be true, but I suspect 9 times out of 10 the person to proffer the advice 'man whatever' does not do so to be helpful. I get annoyed on the OPs behalf when I read responses like that, especially where it costs nothing just to be helpful and give a solution.
 
Old 05-15-2011, 09:48 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
Quote:
Originally Posted by NirvanaII View Post
That might well be true, but I suspect 9 times out of 10 the person to proffer the advice 'man whatever' does not do so to be helpful. I get annoyed on the OPs behalf when I read responses like that, especially where it costs nothing just to be helpful and give a solution.
I notice that those 9 out of 10 times is when the man page either isn't good enough, doesn't include good enough "examples," or the person reading it does not fully understand what he/she is reading. Me personally, man pages are always useful.
 
Old 05-16-2011, 02:21 PM   #9
davedpss
LQ Newbie
 
Registered: May 2011
Posts: 15

Original Poster
Rep: Reputation: 0
Just for the record, I did use the man page and I searched on the internet and I searched this forum. Man pages to me are at times helpful and at times confusing. I didn't find this answer there - it was neither obvious nor obscure. I have no problem with someone telling me about the man page in the spirit of being helpful. The answer to this question could have easily been answered in the same amount of time and effort (and was) and then add that man tar would provide more info if they thought I was unaware of man.

I've used enough lists to know that there is a certain percentage of users that are arrogant and rude. Every time I post a question, I'm planning that somebody is going to take a shot at it to prove their superiority. I'm new to a lot of this stuff (that's why the newbie forum) and I'm sure I will ask more questions that seem stupid to some. I am grateful to those that did answer the question. I want to rip off a bunch of nasty comments and obscenities here but hey, what good would that do.

Now I'm going to set myself up here for someone to take another shot but I would like to show this as solved but not sure how to do that (yes, i have looked around and no, i haven't found anything)

Thanks.
 
  


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
[SOLVED] command for tar'ing multiple sub-directories into a single tar file blainemiller Linux - Server 3 04-21-2011 02:05 PM
tar multiple files in different directories... visitnag Linux - Desktop 1 04-13-2008 11:02 PM
TAR Multiple Directories koolme Linux - Newbie 2 09-14-2007 10:03 PM
TAR'ing multiple directories bob_man_uk Linux - Software 3 02-03-2005 11:08 AM
tar multiple directories computera Linux - General 2 11-17-2001 07:27 AM

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

All times are GMT -5. The time now is 05:22 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