[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using tar



On Mon 15 Jun 2020 at 19:30:31 (+0100), mick crane wrote:
> On 2020-06-15 19:17, Thomas Pircher wrote:
> > mick crane wrote:
> > > I thought you put the options after a hyphen with tar ?
> > 
> > Tar accepts 3 styles of options. The style with a single dash is called
> > the 'UNIX' or 'short-option' style in the man page.
> > 
> > > "tar -cfvz archive_file.tgz ./directory_to_archive"
> > > doesn't work.
> > 
> > The `-f` option requires an argument, the tar file, so with your
> > command, tar would create an output file called 'vz'. The rest of the
> > command line is considered a list of files and directories to
> > include in
> > the archive. Tar fails because the input file archive_file.tgz does not
> > exist.
> > 
> > Try `tar -cvzf archive_file.tgz ./directory_to_archive`.
> 
> yes I see that now
> but without hyphen "f" can be anywhere

It appears you've also forgotten about man pages as well as google.
The man page explains the difference between hyphenated and
unhyphenated forms, and helpfully even gives a single example
written in both forms:

       tar cfv a.tar /etc
       tar -cvf a.tar /etc

For those who find that a challenge, there's even a broken-out
format of the same example for them to copy:

       tar -c -v -f a.tar /etc

Cheers,
David.


Reply to: