[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] How to lock a terminal
From: |
Bob Proulx |
Subject: |
Re: [Nano-devel] How to lock a terminal |
Date: |
Tue, 16 Feb 2016 18:19:04 +0800 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Nick Warne wrote:
> I was in a SSH session, and checking something inadvertently issued:
>
> > nano /var/log/messages | grep a
>
> (I was searching for something else than an 'a', but the above example shows
> the issue - about to use 'nano', but then forgot to change it to 'cat').
>
> The terminal just sits there doing nothing - CTRL+C doesn't do anything; in
> a SSH session, the only option is to kill the terminal. On a local machine,
> you can use kill -9 from another terminal to get out of it.
On a remote machine you can do the same. There really is no
difference between local and remote here. You just use a second
terminal for it.
However this is the perfect case for job control. No need for a
second terminal. Here is an example. Use Control-Z to stop the
foreground job.
address@hidden:~$ nano /var/log/messages | grep a
^Z
[1]+ Stopped nano /var/log/messages | grep a
address@hidden:~$ jobs
[1]+ Stopped nano /var/log/messages | grep a
address@hidden:~$ kill %1
Received SIGHUP or SIGTERM
address@hidden:~$ jobs
[1]+ Terminated nano /var/log/messages | grep a
address@hidden:~$ jobs
address@hidden:~$
Simply stop the process and then kill it using the same terminal.
Bob
P.S. The other suggestions to use Control-X to exit nano are also good
too but job control is general for the entire class type of commands
like this and I think good to know too.
- [Nano-devel] How to lock a terminal, Nick Warne, 2016/02/15
- Re: [Nano-devel] How to lock a terminal, alpha, 2016/02/15
- Re: [Nano-devel] How to lock a terminal, John McKown, 2016/02/15
- Re: [Nano-devel] How to lock a terminal,
Bob Proulx <=
- Re: [Nano-devel] How to lock a terminal, Nick Warne, 2016/02/16
- Re: [Nano-devel] How to lock a terminal, Mike Frysinger, 2016/02/16
- Re: [Nano-devel] How to lock a terminal, Benno Schulenberg, 2016/02/16
- Re: [Nano-devel] How to lock a terminal, Ángel González, 2016/02/16
- Re: [Nano-devel] How to lock a terminal, Bob Proulx, 2016/02/16
- Re: [Nano-devel] How to lock a terminal, Benno Schulenberg, 2016/02/17
- Re: [Nano-devel] How to lock a terminal, Bob Proulx, 2016/02/17
- Re: [Nano-devel] How to lock a terminal, Nick Warne, 2016/02/17
- Re: [Nano-devel] How to lock a terminal, Benno Schulenberg, 2016/02/18
- Re: [Nano-devel] How to lock a terminal, Bob Proulx, 2016/02/19