I noticed this thing today and found it to be awkward. My desktop has the following files :Desktop

But upon running ls in the terminal i got the following output:

 a.out    htc_pass.sh              openmp.cpp~  test.cpp
he.cpp   imp gcc update commands  t.cpp~       test.cpp~
he.cpp~  misirlou (copy).ogg      test2.cpp~   trial.c~
hello    openmp.c                 test.c~      Untitled Document 1~

And it is quite clear from the terminal output that the number of files according to it is much higher than what can actually be seen. Why is this happening?

  • 2
    The files with the ~ at the end... Those look like temporary files that the desktop is hiding... this isn't a bug, by the way, it's probably a function of the desktop. – Thomas Ward Sep 19 '13 at 5:28
  • @ThomasW., okay, but for files which have been deleted a long time back, why is the desktop storing temp files? can it be stopped? – Projjol Sep 19 '13 at 5:31
  • Read my answer. – Thomas Ward Sep 19 '13 at 5:32

Those are the backup files created by you text editor when you edit a file .It is equivalent to *.bak in windows .Although they are pretty handy at times you can turn them off if you desire.

These are specific to the text editor you use but still I can give simple way to turn them off for the two most used text editors

if you use vim add this line to your vimrc set nobackup

If you use gedit In gedit preferences disable Create a backup copy of file before saving

If you use any other specific editor search for the specific way to turn off the backup file creation for the same


They are a backup files, gedit creates them for every edited file. Nautilus hides files .starting_with_dot or ending_with_tilda.txt~ , unless you tell him to show hidden files (ctrl-h or in the menu).


I believe that what you're seeing in ls are temporary files and are being automatically hidden by the Desktop. The files with ~ at the end are sometimes created by text editors and other programs which edit things. The system does not automatically remove them, and some programs don't autoremove them. Some programs will remove the files, but others won't. The files are still there because nothing removed them.

You can remove those pretty easily, however this command here to do so has not been tested thoroughly by myself so be careful with using this:

cd ~/Desktop
rm *.cpp\~ *.c\~ Untitled*

I am uncertain whether those are being automatically hidden in the desktop, however that is what I believe is happening based on what you've said.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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