Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
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 W. 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 W. Sep 19 '13 at 5:32
add comment

4 Answers 4

up vote 2 down vote accepted

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

share|improve this answer
add comment

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).

share|improve this answer
add comment

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.

share|improve this answer
add comment

It would be enough to open Nautilus and go to the Desktop folder (~/Desktop). Nautilus will show all of them, if you check this option.

share|improve this answer
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.