4

I am on Ubuntu 15.10 x64. When I am trying to edit server.js file, it is opening a blank nano editor and displaying "File server.js is being edited (by root with nano 2.4.2, PID xxxx); continue?" with options - Yes, No, Cancel.

I copied a backup file on this file but still I am getting the same message.

Could you please suggest how to resolve this.

  • Check with tools like ps and htop whether this other nano instance is still running. If it's not, there's most likely a hidden dotfile in the same folder which leads nano to believe that the other instance is still running (at least vim works this way, I don't use nano; try ls -lA and look for a file that begins with .server.js or something like that. – Martin von Wittich Jun 5 '16 at 14:52
  • Thank you very much Martin. There was a .server.js.swp in the same directory. Deleting it worked. Can you you please post your comment as answer so that I can accept it. – rangma Jun 5 '16 at 15:08
8

Check with tools like ps and htop whether this other nano instance is still running. If it's not, there's most likely a hidden dotfile in the same folder which leads nano to believe that the other instance is still running (at least vim works this way, I don't use nano; try ls -lA and look for a file that begins with .server.js or something like that.

  • 1
    In my case, an ssh connection was interrupted while editing FILE.txt. nano saved a snapshot in FILE.txt.save and some sort of lock file called .FILE.txt.swp (note the . at the beginning). Deleting the lock file fixed the issue, overwriting the file with the .save version restored my changes. – Jonathan Cross Sep 25 '18 at 1:31
  • Use screen or tmux in the future, no more trouble from interrupted SSH sessions :) – Martin von Wittich Sep 27 '18 at 15:14
2

In addition, if you're the only user on that machine and you're sure that you don't have an open editor on that file in another window, you can just accept nano's offer to continue, it will remove the leftover swap file, saving you a few steps.

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.