[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Send break to screen

From: Michael Parson
Subject: Re: Send break to screen
Date: Thu, 29 Sep 2016 12:30:58 -0500 (CDT)
User-agent: Alpine 2.11 (NEB 23 2013-08-11)

On Thu, 29 Sep 2016, Clark Wang wrote:
On Tue, Sep 27, 2016 at 3:39 PM, Colin Richardson <address@hidden>

@Jostein Berntsen

You were so close. I started playing around with the "stuff" command you
recommended and started to see a pattern forming. I eventually came to the
idea of removed the single quotes around your suggestion 'stuff " "' and
just used -X stuff "^C" and it worked.

Thank you. I got it working now with -X stuff "^C"
No need to mess around with PID and process killing now.

Where is this kind of usage (stuff ^X) documented? I did not found it in
screen manual.

The 'stuff' command is in the screen manpage:

stuff [string]

Stuff the string string in the input buffer of the current window.
This is like the "paste" command but with much less overhead.  Without
a parameter, screen will prompt for a string to stuff.  You cannot
paste large buffers with the "stuff" command. It is most useful for key
bindings. See also "bindkey".

The usage they are using is a combo of using 'stuff' with the '-X' flag
which lets you send commands to a screen session via the shell (rather
than from the : prompt inside of screen).

The following are equivilant:

$ screen -X stuff "echo hello"

Or, from inside of screen

C-a : stuff "echo hello"

You can also use the screen "at" command to send it to a named window
or windows:

$ screen -X at "server-1" stuff "sudo systemctl status httpd^M"

Or, if you have a bunch of windows with the same prefixed name:

$ screen -X at "server-#" stuff "sudo systemctl status httpd^M"

I use the 'stuff' command in my .screenrc to start up multiple windows,
each named for the system I am ssh-ing into, and then use the 'stuff'
command to stuff the ssh command onto the command line:

screen -t webserver1 -fn 1
        stuff "ssh webserver1^M"
screen -t contoller2 -fn 5
        stuff "ssh controller2^M"

With ssh keys and agents, I don't even have to type in my password.

I use the above method rather than telling screen to start the ssh
session as the window process so that when the ssh session dies, I can
just switch back to that window, hit the up arrow and return to get back

Michael Parson
Pflugerville, TX

reply via email to

[Prev in Thread] Current Thread [Next in Thread]