Difference between [ tar cvf archive.tar * ] and [ tar cvf archive.tar . ]
Emily Wong
Difference between tar cvf archive.tar * and tar cvf archive.tar ..
Is there any difference in the archive produced?
I couldn't find anything when I googled this.
1 Answer
The difference between the two formats is that the asterisk one tars the files, while the dot one tars the current folder.
The dot format will get you an extra folder level inside the tar file. For the trouble this causes see the postCreate a tar archive of the current directory without preceding period.
Another difference is the handling of hidden files and files that start with
a dot that are also considered as hidden.
The shell expands * only to files in the current directory that are not
considered as hidden.
Using dot will collect all files in the current directory
including hidden ones, packing the entire folder as-is.