How to use ‘tar -c’ without any optional arguments

mantar

In the synopsis section of the manual page for tar, it reads tar -c [-f ARCHIVE] [OPTIONS] [FILE...]. Knowing arguments in the brackets [] are optional, it seems we must be able to use tar -c without any more options or arguments. Is there an example of it? Or am I misunderstanding the meaning of [] in the synopsis?

Best Answer

Neither the way that you have read the manual nor the way the manual was written is a mistake; it's just that most of us no longer use a tape drive, so the option to use -f does not make immediate sense. tar means tape archiver. We have to use -f to tell tar not to use the tape drive. But from the utility's "point of view," it is still foremost a tape archiver, so -f is indeed an option.

How to use 'tar -c' without any optional arguments?

Use a tape drive!


July 10, 2019

Thanks to @roaima for his comment in another question, it may be possible to set the TAPE variable to /dev/null in order to use tar -c: export TAPE=/dev/null; tar -c or TAPE=/dev/null tar -c.

Related Question