I was editing a code in raspberry with the nano editor and I accidentally turned off the raspberry and now when I opened the file, there is nothing, any idea of how to recover the code?

  • what does running "ls -la" in the folder containing the file show for file size? If it appears to still contain code(not 0 bytes) you can "cat filename" to print the file out and see what it contains. If its actually gone, you are probably out of luck.
    – Chad G
    Apr 24, 2019 at 23:07
  • 2
    Restore the file from your last backup.
    – Ingo
    Apr 25, 2019 at 9:27

1 Answer 1


You can try looking at the solutions here but they are quite advanced and I would say there's little chance of recovery unless you get quite lucky.

  • Thanks for the answers, sadly I tried them all, but I think I will start rewriting, thanks! Apr 25, 2019 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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