File Ex6.sh Is Being Edited by With Nano 2.5.2 Pid
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.
asked Jun 5 '16 at 14:34
rangmarangma
83 1 gold badge 1 silver badge 3 bronze badges
2
4 Answers 4
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.
answered Jun 5 '16 at 15:09
2
-
In my case, an ssh connection was interrupted while editing
FILE.txt
. nano saved a snapshot inFILE.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.Sep 25 '18 at 1:31
-
Use
screen
ortmux
in the future, no more trouble from interrupted SSH sessions :)Sep 27 '18 at 15:14
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.
answered Jun 5 '16 at 15:38
1
-
Best answer! Thanks!
Apr 1 at 15:38
On my Ubuntu Linux server it gives me an option to hop back into the stopped nano job:
Use "fg" to return to nano.
So, you could try to simply type fg
.
John Smith
2,163 1 gold badge 11 silver badges 16 bronze badges
answered Jan 14 at 18:20
I was editing a file called serial.c
and ran into that problem. I backed the file up using cp serial.c serial2.c
and then deleted the original with rm serial.c
. Issuing a nano serial.c
still returned the error, even though the file didn't exist. Performing an ls -lA
revealed that there was a hidden swapfile called .serial.c.swp
, which I deleted using rm .serial.c.swp
. Then I was able to rename my serial2.c
back to serial.c
using mv serial2.c serial.c
, and now I'm able to edit the file without the conflict.
answered Aug 22 '20 at 19:11
1
-
This is basically a rehash of the accepted answer, augmented by the specifics of your experience. For future reference, renaming the file is unnecessary; just delete the
.swp
file.Aug 22 '20 at 19:53
Not the answer you're looking for? Browse other questions tagged ubuntu nano or ask your own question.
File Ex6.sh Is Being Edited by With Nano 2.5.2 Pid
Source: https://unix.stackexchange.com/questions/287798/file-server-js-is-being-edited-by-root-with-nano-2-4-2-pid-xxxx-continue/287809
Check with tools like
ps
andhtop
whether this othernano
instance is still running. If it's not, there's most likely a hidden dotfile in the same folder which leadsnano
to believe that the other instance is still running (at leastvim
works this way, I don't usenano
; tryls -lA
and look for a file that begins with.server.js
or something like that.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.
Jun 5 '16 at 15:08