I have a directory on my linux os(Ubuntu) full of files that start with a tilde sign(e.g. example.txt~, example.py~). When I look at my directury using the regular gui I don't see any files there. But when I do ls in that directory I see such files. what do these files do and how do I get rid of them?
|
|
||||
migrated from stackoverflow.com May 21 '12 at 23:24
|
Since you seem to be having trouble, removing any file with a '~' anywhere in the file name would be as easy as adding another asterisk. Example: rm *\~* Strange that whatever application would place the tilde in the beginning of the file name, I've never seen that. |
|||||
|
|
These are probably temporary or backup files. Gedit will prepend a tilde to backup files http://chrisjean.com/2009/02/09/getting-rid-of-tilde-files-in-ubuntu/ You are probably using a program that prepends a tilde for a similar purpose. To delete them from the current directory
You can also use the |
||||
|
|
Tildes are generally used to indicate that the file is a backup copy of another file, so they're generally not shown in Nautilus and other file managers. In your case, it looks like you were editing a few files in Emacs or Vim and had the editor's process terminated while you were editing them. |
|||
|
|
|
They were probably created by another program (or by accident from a mis-typed command). If you really don't want them (you can open them up to make sure you don't need them), you can delete them just like any other file. Based on other answers it sounds like they're probably backup files. The tilde is a special character, so you have to escape it with a backslash to refer to it from the command line. You could delete them all with this command:
To view the contents of any one file, you could do this:
|
|||||||
|
|
~ is often used to indicate backup or temporary files. That is why you probably can't see them in your GUI. You can removed them with the shell command "rm", but before you do, you probably want to consider why they are there. Perhaps your GUI or some other tool you are running creates them and is relying on them - removing them from underneath the tool may have unintended consequences. Any particular reason you think you need to remove them? |
|||
|
|
|
First
or
|
|||
|
|
|
I found that in Linux Mint if you go So
|
||||
|
|
file.txt~), it is a traditional way of denoting backups. – choroba May 21 '12 at 21:47