Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the bash command "rm *~" do?

Does the bash command rm *~ just remove files ending in tilde or is there a more advanced bash or gnu make pattern here? Google does not seem able to search for this two symbol combination. I found this in a Makefile clean: target.

Would gnu make ever create files with trailing ~'s using only the implicit rules?

like image 409
Mike Avatar asked Jan 01 '11 00:01

Mike


1 Answers

The ~ (tilde) character has a special meaning in a path in two cases:

~user        # the home directory of user
~/folder     # folder inside your home directory

For the most part, that's it. The command you refer to does exactly what it looks like it does: removes files whose names end in a tilde. Text editors such as emacs save backup copies of files under filenames ending in tildes.

So, this command is probably used to remove these backup copies from the current directory (but not subdirectories). One reason why one would want to do so is if the directory will be copied to a web server, as server-side code (e.g. PHP files) can contain sensitive information such as passwords.

like image 145
PleaseStand Avatar answered Sep 19 '22 22:09

PleaseStand