Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Ubuntu 10.04, there is a file that appears when I use the ls command with ~ right next to its name, like:

file.c ~

I can't open it, rename it, or copy it.

When I try to access it, I get the error:

"cannot stat 'file.c' : No such file or directory."

How can I open or restore this file ?

share|improve this question

migrated from stackoverflow.com Dec 2 '11 at 12:55

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

Files that ended with ~ are usually temporary files or backup files generated by other programs such as editors.

Most of the time this behavior can be corrected.

In your case, you have to be sure that this file still exists:

ls

If the file appears, then you can edit it or rename it like this:

mv my-file.c~ new-name.c
nano my-file.c~

However if the file isn't there, that means that either you are in the wrong directory or the file has been deleted.

To recover your file there, are some tools that can be used to do so.

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.