LinuxQuestions.org
Register a domain and help support LQ
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 08-23-2010, 02:02 PM   #1
rmknox
Member
 
Registered: May 2010
Posts: 354

Rep: Reputation: 34
Tar syntax


I'm sure this is easy for the pros who hang out here, but I'm lost

info tar para 4.6 gives an example - two parts confuse me

the example
Code:
tar --directory=srcdir --create --file=- .
I'm confused by the 3rd and 4th args
in the 3rd, "--file=-" apparently <dash> is used as a wild card. I don't see this convention explained in the tar documentation and don't recognize it based on my limited undrstanding of the POSIX regular expression syntax

the 4th arg consists of a period - I dont understand why it is there

Maybe someone can help lift my ignorance
thanks
Dick

Last edited by rmknox; 08-23-2010 at 02:04 PM.
 
Old 08-23-2010, 02:44 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
In general, the '-' notation is used as shorthand for either standard input or standard output, as appropriate to the scenario. In your example case I would say it means that the resulting tarball would be written to standard output. The '.' notation is the top directory from which to build the tarball. Do 'ls -la' at a shell prompt, and you will see the directory '.', referring to the toplevel directory specified, often the current working directory (as in this case).
--- rod.
 
1 members found this post helpful.
Old 08-23-2010, 02:49 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,570

Rep: Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697
info tar is the interminable info page. have fun. no manpage.

I use tar this way
tar -options where options include one from each line

c or x for create or extract
z or j for gzip or bzip2
v for verbose
f for filename which is the tar filename and has to be after the f

then if you are creating a tar,
- for stdin
/some/files/

e.g. tar -xzvf some.tar.gz to open it
tar -cjf some.tar.bz2 /mydir/* to tar the directory tree under mydir.
 
1 members found this post helpful.
  


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
tar | ssh (tar > .tar) syntax issues EarlMosier Linux - Software 6 12-21-2006 01:28 AM
Tar for backups ? Proper syntax ? Reefcrazed Linux - Newbie 8 02-21-2006 06:18 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 syntax to backup system... robbow52 Debian 5 08-05-2004 12:35 PM
Tar syntax JTD Linux - Newbie 2 10-28-2003 05:28 PM


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