Is it possible to use tar to compress a folder without giving the filename of the archive to store in?
Normally you use:
tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog
I want to do something like
tar -zcvf /home/jerry/prog
and have it create prog.tar.gz
Best Answer
You can't use
tar
this way. Or you need to patch it.If you don't give a file (you don't use the
-f
option),tar
will use the standard output by default, i.e. the terminal and eventually fail because it will refuse to write compressed data on the terminal.So, you have to call
tar
the proper way :tar -zcvf prog.tag.gz /home/jerry/prog
.