Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Difference between [ tar cvf archive.tar * ] and [ tar cvf archive.tar . ]

Writer 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.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy