JTLee
JTLee

Reputation: 99

Difference between ./* (star) and ./*.* (star dot star)

Is it the same for using ./* or ./. ?

For instance, if I try

chmod 755 ./* -R

or

chmod 755 ./*.* -R

It will get the same results, making the files and directories here using 755 permission. But I would want to know is there any different part of concept between these two methods?

Upvotes: 4

Views: 2776

Answers (2)

JTLee
JTLee

Reputation: 99

I tried in three ways. For testing first make a directory. "a" by mkdir a, also touch a new text file "b.txt" and directory "c" in folder "a". Then touch a "f.txt" text file in "c" folder.

a-----|- b.txt | |- c - f.txt

chown root:root a ----> make only "a" folder permission to root

chown root:root a/* ----> make files and directories in "a" permission to root but not "a" folder-self and not "f.txt" in "c" directory.

chown root:root a/*.* ----> make files in "a" permission to root but not "a" folder-self and directories in "a" and not "f.txt" in "c" directory.

and try -R argument

chown -R root:root a ----> make files in "a" permission to root and directories in "a" and "f.txt" in "c" folder to root as well as "a" folder-self

chown -R root:root a/* ----> make files in "a" permission to root and directories in "a" and "f.txt" in "c" folder to root but not "a" folder-self

chown -R root:root a/*.* ----> make files in "a" permission to root but not directories in "a", "f.txt" in "c" folder and "a" folder-self

Upvotes: 0

Charles Duffy
Charles Duffy

Reputation: 295815

*.* (aka "star dot star", or "asterisk period asterisk") limits your glob to only match files with .s in their names. By contrast, * alone has no such limitation, and will match files with no .s in their names at all, in addition to also matching files with names containing .s.

MS-DOS was designed such that all files had extensions, by having a three-character extension field always present inside the filesystem's directory structure (even if those extensions were empty), so *.* was a global wildcard there -- but this has never been true on UNIXlike systems, so folks typing *.* are presumably doing so as a habit carried over from other platforms.

Upvotes: 6

Related Questions