1832857 Members
3080 Online
110048 Solutions
New Discussion

querry reg tar

 
Prashanth Waugh
Esteemed Contributor

querry reg tar

hi every one,
can anyone tell me what is the o/p of the below given command if I am not giving the name of the tar file while creating the tar.
where it is creating that file.

tar -cvf

regards
atulkumar
For success, attitude is equally as important as ability
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: querry reg tar

Shalom atulkumar

If I understand you, the question is what will happen if you do not specify a filename with tar.

The command will error out and perform no work.

tar -cvf *

Produces no output

tar -cvf my.tar

Will produce a recursive tar file of everything from where the command is run.

This is all on the man page.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Kenan Erdey
Honored Contributor

Re: querry reg tar

Hi,

if you don't give the name of file (so don't use f option) it writes to your tape.

Kenan.
Computers have lots of memory but no imagination
Dennis Handly
Acclaimed Contributor

Re: querry reg tar

I get:
$ tar -cvf file_name
Attempt to create archive of no files. Nothing dumped.
$ tar -cvf
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[-C directory] file] ...
Ernesto Cappello
Trusted Contributor

Re: querry reg tar

Hi

I agree with Kenan , in fact if you don't give the name of file (so don't use f option) it writes to your tape (if it exits) otherwise in stdin/stdout.

The standard, for example, is:

tar cvf tmp.tar /tmp

to create a tar file for /tmp directory.

Best regards.
Ernesto
Avinash20
Honored Contributor

Re: querry reg tar

tar (1)
The tar command saves and restores archives of files on a magnetic tape, a flexible disk, or a regular file.
The default archive file is /dev/rmt/0m.

SYNOPSIS
# tar [-]key [arg ...] [file | -C directory] ...

f

Use the next arg argument as the name of the archive instead of the default, /dev/rmt/0m. If the name of the file is -, tar writes to standard output or reads from standard input, whichever is appropriate, and the default blocking factor becomes 1. Thus, tar can be used as the head or tail of a pipeline
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
SKR_1
Trusted Contributor

Re: querry reg tar

Go ahead with Kenan and Ernesto

Thanks
Steven Schweda
Honored Contributor

Re: querry reg tar

> tar -cvf *
> Produces no output

Because "tar" can read your mind, so it knows
that the first argument produced by expanding
"*" is _not_ supposed to go with "-f"?

> if you don't give the name of file (so
> don't use f option) [...]

But he _did_ "use f option".

If the question is, "What does it do?", then
why not try it and see? This would seem (to
me) to be more reliable than asking anyone.

If the question is, "How should I do
?, then you may need to explain
what is.