If I'm in a directory like:
/home/usr_name/Documents/test
And, accidentally, I launch:
rm .*
What happens?
I thought it would remove all the files that contained a dot.. but I definitely was wrong!
If I'm in a directory like:
/home/usr_name/Documents/test
And, accidentally, I launch:
rm .*
What happens?
I thought it would remove all the files that contained a dot.. but I definitely was wrong!
It matches .*
according to the globbing rules of your shell. For the shells I'm familiar with (bash, tcsh) it will match all files beginning with a dot. Use *.*
for all files containing a dot or *.
for all files ending with a dot.
In general, *
matches any sequence of characters; however, it will not usually match a leading dot (i.e. *
by itself won't match filenames beginning with a dot, but .*
will).
When using rm
and not sure about using wild characters *
, always do a
ls .*
whatever is the output, that is what rm
is going to work on when you do a rm .*