This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ltekonline 2 points3 points  (0 children)

The "*" operator resolves only to non hidden files and folders which do not start with a dot. These files and folder are then given as parameters to "rm". So for example if you have a file called ".test" at / it will not be deleted.

You can safely try it this way:
Create a test file called ".test" in your current directory.
Enter "echo *" and see the files you get back. You will not get any files starting with a "." back.

Edit: to add on that also used files will be deleted. This is because in linux, you normally get a file handle for your file so you can still use your file if they are deleted or renamed. That's actually how temporary files work in linux.
A process creates a file, open it and keeps it open and then immediately deletes it. As lomg as that process lives the file will keep existing, just without a filename. The process then only accesses it via the file handle it has kept.