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?
Quitting Nano To quit nano, use the Ctrl+X key combination. If the file you are working on has been modified since the last time you saved it, you will be prompted to save the file first. Type y to save the file, or n to exit nano without saving the file.
You can use the following shortcut keys in nano to undo or redo: Alt + U is used to undo anything in the nano editor. Alt + E is used to redo anything in the nano editor.
The Ctrl+r (Read File) shortcut allows you to read a file in the current editing session 3.Then, in the search prompt, type the file name (mention full path) and hit Enter. It will open the existing “ sample.txt ” file in the Nano editor. In this method, we will open the file right from the command line.
If you've already opened nano, you can press Ctrl + R to open a file. On exit ( Ctrl + X) nano will ask you whether to save the file. You can save it manually with F3. Answer n for no in the Ctrl + X dialogue.
To exit nano press Ctrl+x. If there are unsaved changes, you’ll be asked whether you want to save the changes. To save the file, you must have at write permissions to the file. If you are creating a new file , you need to have write permission to the directory where the file is created.
If you don’t have nano installed on your system, you can install it using the package manager of your distribution. To open an existing file or to create a new file, type nano followed by the file name:
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...
nano creates a lock file once you try to edit the file, I would say just try to move it and it might work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With