15

I have a tendency to miss-type while trying to Ctrl-X to exit nano.

Every now and then I'll try to re-open the file and get the Nano "File xxx is being edited". How do I switch back to the open file? And also, what am I miss-typing to cause this to happen?

Tksd
  • 151
  • 1
  • 1
  • 3
  • 3
    You might be hitting ctrl-z and putting in the background (you'll see "[1]+ Stopped ..."). Try "jobs" and "fg". – jamieguinan Mar 04 '20 at 14:36

2 Answers2

32

First check if there is a process editing the file.

$> jobs

You will get a list of background jobs, look for Stopped ones.

If there is and it's your editor, try re-attaching to it:

$> fg <n>

Else, if there is no running nano, make sure there is no lock-file.

ls -A *.swp

If there is, remove it.

rm nnn.swp

If you still have trouble editing the file, reboot and restart above. Maybe there are more things to try, but that's all I can think of...

OriginalHacker
  • 671
  • 6
  • 8
2

nano creates a lock file once you try to edit the file, I would say just try to move it and it might work.

Iheb Abouda
  • 82
  • 1
  • 9