Command Line – What Does *~ Mean?

command linefilenamesrm

At the end of a makefile I saw

rm -f *~ *.class

I understand the *.class, but what's *~?

Best Answer

It's basically removing backup files.

*~ means all files ending in ~.

Many Unix/Linux systems programs create backup files that end in ~.

For example, the emacs and nano editors automatically save a backup copy of each file you edit. When it saves a file, the old version gets saved using the file name with a tilde (~) added to the end.

Vim will do the same if you put :set backup in your .vimrc.

*~ on Unix/Linux is like *.bak on Windows.

Related Question