Re: How to lock a terminal

2016-02-17 Thread Bob Proulx
Benno Schulenberg wrote:
> Bob Proulx wrote:
> > I do not have a nanorc file at all.  The defaults are okay for
> > suspension without any specific configuration.
> 
> ??  How does that work?  What version of nano are you using?

Since this has nothing to do bash I am going to take this to the nano
list only.

Bob



Re: How to lock a terminal

2016-02-16 Thread Bob Proulx
Benno Schulenberg wrote:
> Bob Proulx wrote:
> > [...] 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.
> 
> For that to work, it requires having 'set suspend' in your
> nanorc.  (Which I don't have, because it annoys me when nano
> drops into the background when I accidentally hit ^Z.)

I do not have a nanorc file at all.  The defaults are okay for
suspension without any specific configuration.

Since you are specifically configuring suspend disabled one must
presume that you will already know about job control and have
specifically disabled it and will work around it by other means.  Such
as in your case M-Z or another terminal or other method.

Bob



Re: How to lock a terminal

2016-02-16 Thread Mike Frysinger
On 16 Feb 2016 18:19, Bob Proulx wrote:
> 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.

sometimes ^Z doesn't work once nano starts up.  probably should add
isatty checking to nano itself.
-mike


signature.asc
Description: Digital signature


Re: How to lock a terminal

2016-02-16 Thread Nick Warne

OK, everybody,

Thanks for the replies.  As I stated, it was me being stupid - why I 
didn't think of Ctrl+Z I don't know - I have only been using GNU/Linux 
for 14 years :)


Mind you, it was late and I was rushing to stop my Raspberry Pi 
connecting to the AP rather than the range extender.


Sorry for the noise.

Nick

On 16/02/16 10:19, Bob Proulx wrote:

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.

   rwp@havoc:~$ nano /var/log/messages | grep a
   ^Z
   [1]+  Stopped nano /var/log/messages | grep a
   rwp@havoc:~$ jobs
   [1]+  Stopped nano /var/log/messages | grep a
   rwp@havoc:~$ kill %1
   Received SIGHUP or SIGTERM
   rwp@havoc:~$ jobs
   [1]+  Terminated  nano /var/log/messages | grep a
   rwp@havoc:~$ jobs
   rwp@havoc:~$

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.



--
Gosh that takes me back... or is it forward?  That's the trouble with
time travel, you never can tell."
-- Doctor Who "Androids of Tara"



Re: How to lock a terminal

2016-02-16 Thread Bob Proulx
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.

  rwp@havoc:~$ nano /var/log/messages | grep a
  ^Z
  [1]+  Stopped nano /var/log/messages | grep a
  rwp@havoc:~$ jobs
  [1]+  Stopped nano /var/log/messages | grep a
  rwp@havoc:~$ kill %1
  Received SIGHUP or SIGTERM
  rwp@havoc:~$ jobs
  [1]+  Terminated  nano /var/log/messages | grep a
  rwp@havoc:~$ jobs
  rwp@havoc:~$ 

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.



Re: How to lock a terminal

2016-02-15 Thread John McKown
Try a

Ctrl-X

That worked for me with the exact same command line as yours. It exits nano.

On Mon, Feb 15, 2016 at 11:24 AM, Nick Warne  wrote:

> Hi Everybody,
>
> I ma not sure if this is a bug, or if it is what causes it - if it isn't,
> then it is me being stupid.
>
> 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.
>
> I don't know if this behaviour is expected or me being stupid, or
> something else going on.
>
> Regards,
>
> Nick
> --
> Gosh that takes me back... or is it forward?  That's the trouble with
> time travel, you never can tell."
> -- Doctor Who "Androids of Tara"
>
>


-- 
The man has the intellect of a lobotomized turtle.

Maranatha! <><
John McKown