Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't pause nano in terminal

Trying to learn how to use terminal here.

So I can use ctrl-z to pause other processes, but for some reason it does not work in nano. Why that would be?

like image 488
Jadam Avatar asked Apr 16 '13 17:04

Jadam


People also ask

How do I quit 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.

How do I get out of nano editor on Mac?

To exit nano, all you need to do is to press CTRL + X . If you have any changes that have not been saved, you'll be prompted to save the changes before you quit the editor.

What is Ctrl Z in nano?

It turns out ctrl-z is a global command to send the current process to the background (not just nano) and here's a way to get a background process back, simply type: fg. and nano will be back in the terminal as it was before hitting ctrl-z.


2 Answers

I was looking for a solution to this and the accepted answer didn't help me.

Setting set suspend in ~/.nanorc works!

http://www.nano-editor.org/dist/v2.2/nanorc.5.html

like image 116
E. Sundin Avatar answered Nov 04 '22 14:11

E. Sundin


This can be easily done by masking the SIGTSTP signal:

#include <signal.h>

signal(SIGTSTP,SIG_IGN); /* disable ctrl-Z */

That's what nano is doing, apparently.

If you want nano to allow you for suspending it with ctrl-z you can put the line:

set suspend

into your $HOME/.nanorc.

like image 30
piokuc Avatar answered Nov 04 '22 13:11

piokuc