Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

At the end of a makefile I saw

rm -f *~ *.class

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

share|improve this question
4  
See: stackoverflow.com/questions/4572809/… –  camh Feb 2 '11 at 1:19
add comment

1 Answer

up vote 19 down vote accepted

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.

share|improve this answer
    
Ah! I was overthinking it. Thought it was removing all home directories or something... –  Xodarap Feb 2 '11 at 1:20
15  
~ only get expanded into a home directory if it appears at the start of a word. –  Mikel Feb 2 '11 at 1:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.