LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-06-2006, 09:43 AM   #1
tomd1985
LQ Newbie
 
Registered: Feb 2006
Posts: 1

Rep: Reputation: 0
Tar command


Hi, basically im trying to copy a directory tree named a/b/c to another directory tree backup/options both located on my home directory(cd). Ive been messing around with the tar commands but nothing seems to work. Any help would be great.

Cheers
 
Old 02-06-2006, 10:10 AM   #2
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
errr, sorry come again :? What are you trying to do?

Maybe you want: man rsync
rsync -av /src/foo/ /dest/foo

or maybe: ls > ~/somedir/textfile.txt

Or a simple: cp -R ./source ./destination

Last edited by muha; 02-06-2006 at 10:11 AM.
 
Old 02-06-2006, 10:11 AM   #3
Hobbletoe
Member
 
Registered: Sep 2004
Location: Dayton, Oh
Distribution: Linux Mint 10, Linux Mint 11
Posts: 148

Rep: Reputation: 18
You could use cp (with the -r option so that it will recursively grab directories) for this. tar is usually if you want to backup the data into a single file in case it needs to be restored at a later date, or you are moving data to a different machine. To copy your directory tree, you'd just

Code:
cp -r ~/a/b/c/* ~/backup/option
Assuming that you only want to backup from that c directory and down. Note that if you omit the /* from the source name, you'll end up with a ~/backup/option/c directory which may or may not be what you want. If you want to do from ~/a down, then it would be just

Code:
cp -r ~/a/* ~/backup/option
Tryto keep it simple. In this case, there is no real need to use tar when a simple cp will do. I tried to figure out how to tar/untar in the same command using a pipe, and couldn't figure it out. And really, if it can be done with a single command with no pipes, that will be your best bet, especially should something go wrong ... less steps to look through.

Last edited by Hobbletoe; 02-06-2006 at 11:07 AM.
 
Old 02-06-2006, 11:01 AM   #4
dudulz
Member
 
Registered: Feb 2005
Location: Australia
Distribution: [Redhat] [Slackware] [SuSe] [FreeBSD]
Posts: 81

Rep: Reputation: 15
you should hava to read 'man tar'. tar -cf tes.tar a/b/c is command to create *.tar.
 
  


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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
Need help with 'tar' command danishmr Linux - General 2 06-07-2004 10:34 AM
tar command.. johnyy Linux - Software 4 12-31-2003 11:54 PM
Tar command satimis Linux - Newbie 1 11-22-2003 10:46 AM
Tar command satimis Linux - Newbie 3 11-03-2003 11:34 PM


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