Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"tar czf file.tar.gz dirname" or "tar -czf file.tar.gz dirname"?

Tags:

unix

gzip

tar

I always use tar czf file.tar.gz dirname instead of tar -czf file.tar.gz dirname (without -) because faster

I know... from the documentation, what I'm doing is wrong.

But what is the effect of my command?

(so far, I dont see any problem of my command... sometime I think why the documentation suggest tar -czf file.tar.gz dirname instead of tar czf file.tar.gz dirname?)

like image 273
Captain Avatar asked Dec 19 '10 14:12

Captain


1 Answers

It's all in the info pages:

“Like short options, "old options" are single letters. However, old options must be written together as a single clumped set[...] this old style syntax makes it difficult to match option letters with their corresponding arguments, and is often confusing. In the command tar cvbf 20 /dev/rmt0, for example, 20 is the argument for -b, /dev/rmt0 is the argument for -f, and -v does not have a corresponding argument. Even using short options like in tar -c -v -b 20 -f /dev/rmt0 is clearer, putting all arguments next to the option they pertain to.”

And you don't want to confuse your users, do you?

like image 95
user502515 Avatar answered Oct 15 '22 21:10

user502515