Access xterm's scrollback buffer as a file

Clash Royale CLAN TAG#URR8PPP
up vote
8
down vote
favorite
Is it possible to, somehow, access xterm's scrollback buffer as a (read-only) file or a character device?
The core issue (to avoid x/y "problemming"), is this:
sometimes the command I've just executed creates non-deterministic output, and I'd like to use its output somehow without pre-thought of tee-ing it. Right now, the only way to do this (that I'm aware of) is to use the mouse to select the text into primary selection.
xterm
add a comment |Â
up vote
8
down vote
favorite
Is it possible to, somehow, access xterm's scrollback buffer as a (read-only) file or a character device?
The core issue (to avoid x/y "problemming"), is this:
sometimes the command I've just executed creates non-deterministic output, and I'd like to use its output somehow without pre-thought of tee-ing it. Right now, the only way to do this (that I'm aware of) is to use the mouse to select the text into primary selection.
xterm
Alternative to usingtee. Have you considered runningscriptto create a log of all your commands to a file?
â Stephen Quan
Apr 30 at 0:16
add a comment |Â
up vote
8
down vote
favorite
up vote
8
down vote
favorite
Is it possible to, somehow, access xterm's scrollback buffer as a (read-only) file or a character device?
The core issue (to avoid x/y "problemming"), is this:
sometimes the command I've just executed creates non-deterministic output, and I'd like to use its output somehow without pre-thought of tee-ing it. Right now, the only way to do this (that I'm aware of) is to use the mouse to select the text into primary selection.
xterm
Is it possible to, somehow, access xterm's scrollback buffer as a (read-only) file or a character device?
The core issue (to avoid x/y "problemming"), is this:
sometimes the command I've just executed creates non-deterministic output, and I'd like to use its output somehow without pre-thought of tee-ing it. Right now, the only way to do this (that I'm aware of) is to use the mouse to select the text into primary selection.
xterm
asked Apr 29 at 16:20
John Z.
433
433
Alternative to usingtee. Have you considered runningscriptto create a log of all your commands to a file?
â Stephen Quan
Apr 30 at 0:16
add a comment |Â
Alternative to usingtee. Have you considered runningscriptto create a log of all your commands to a file?
â Stephen Quan
Apr 30 at 0:16
Alternative to using
tee. Have you considered running script to create a log of all your commands to a file?â Stephen Quan
Apr 30 at 0:16
Alternative to using
tee. Have you considered running script to create a log of all your commands to a file?â Stephen Quan
Apr 30 at 0:16
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
5
down vote
accepted
You could do this by telling xterm to print the data using the print-everything action (normally not bound to a key).
Alternatively, there's an escape sequence documented in XTerm Control Sequences:
CSI ? Pm i
Media Copy (MC), DEC-specific.
Ps = 1 -> Print line containing cursor.
Ps = 4 -> Turn off autoprint mode.
Ps = 5 -> Turn on autoprint mode.
Ps = 1 0 -> Print composed display, ignores DECPEX.
Ps = 1 1 -> Print all pages.
which could be invoked as
printf '33[?11i'
But either approach (to write to a file) would need a printerCommand configured.
Is it possible to do that without restarting xterm? If it involves restarting xterm it is not really an answer as that would cause the output to be lost.
â kasperd
Apr 29 at 17:54
This is what I was looking for. Resources can be reloaded on the fly, and I'm OK to restart xterm. I've created a named fifo and configured it into printerCommand, have bound print-everything command to a key and it works exactly as I wanted it to.
â John Z.
May 18 at 18:18
add a comment |Â
up vote
1
down vote
You can always use something like tmux which provides capture-pane that does what you want, along with splits (vertical and horizontal) and multiplexing, session support, and a slew of other things.
Or use a different terminal emulator xfce4-terminal is also lightweight and provides an easy Save Contents
1
To me this does not sound like an answer to the question. None of those programs can magically capture output which at the moment exist only in an xterm window.
â kasperd
Apr 29 at 17:56
@kasperd a fair interpretation. He wants something that captures without pre-thought. I usetmuxwithout prethought. Then I don't have this problem. If you can get in the habit of using tmux, you'll never have to think about this again (or a lot of other stuff).
â Evan Carroll
Apr 29 at 18:10
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
You could do this by telling xterm to print the data using the print-everything action (normally not bound to a key).
Alternatively, there's an escape sequence documented in XTerm Control Sequences:
CSI ? Pm i
Media Copy (MC), DEC-specific.
Ps = 1 -> Print line containing cursor.
Ps = 4 -> Turn off autoprint mode.
Ps = 5 -> Turn on autoprint mode.
Ps = 1 0 -> Print composed display, ignores DECPEX.
Ps = 1 1 -> Print all pages.
which could be invoked as
printf '33[?11i'
But either approach (to write to a file) would need a printerCommand configured.
Is it possible to do that without restarting xterm? If it involves restarting xterm it is not really an answer as that would cause the output to be lost.
â kasperd
Apr 29 at 17:54
This is what I was looking for. Resources can be reloaded on the fly, and I'm OK to restart xterm. I've created a named fifo and configured it into printerCommand, have bound print-everything command to a key and it works exactly as I wanted it to.
â John Z.
May 18 at 18:18
add a comment |Â
up vote
5
down vote
accepted
You could do this by telling xterm to print the data using the print-everything action (normally not bound to a key).
Alternatively, there's an escape sequence documented in XTerm Control Sequences:
CSI ? Pm i
Media Copy (MC), DEC-specific.
Ps = 1 -> Print line containing cursor.
Ps = 4 -> Turn off autoprint mode.
Ps = 5 -> Turn on autoprint mode.
Ps = 1 0 -> Print composed display, ignores DECPEX.
Ps = 1 1 -> Print all pages.
which could be invoked as
printf '33[?11i'
But either approach (to write to a file) would need a printerCommand configured.
Is it possible to do that without restarting xterm? If it involves restarting xterm it is not really an answer as that would cause the output to be lost.
â kasperd
Apr 29 at 17:54
This is what I was looking for. Resources can be reloaded on the fly, and I'm OK to restart xterm. I've created a named fifo and configured it into printerCommand, have bound print-everything command to a key and it works exactly as I wanted it to.
â John Z.
May 18 at 18:18
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
You could do this by telling xterm to print the data using the print-everything action (normally not bound to a key).
Alternatively, there's an escape sequence documented in XTerm Control Sequences:
CSI ? Pm i
Media Copy (MC), DEC-specific.
Ps = 1 -> Print line containing cursor.
Ps = 4 -> Turn off autoprint mode.
Ps = 5 -> Turn on autoprint mode.
Ps = 1 0 -> Print composed display, ignores DECPEX.
Ps = 1 1 -> Print all pages.
which could be invoked as
printf '33[?11i'
But either approach (to write to a file) would need a printerCommand configured.
You could do this by telling xterm to print the data using the print-everything action (normally not bound to a key).
Alternatively, there's an escape sequence documented in XTerm Control Sequences:
CSI ? Pm i
Media Copy (MC), DEC-specific.
Ps = 1 -> Print line containing cursor.
Ps = 4 -> Turn off autoprint mode.
Ps = 5 -> Turn on autoprint mode.
Ps = 1 0 -> Print composed display, ignores DECPEX.
Ps = 1 1 -> Print all pages.
which could be invoked as
printf '33[?11i'
But either approach (to write to a file) would need a printerCommand configured.
edited Apr 29 at 18:31
answered Apr 29 at 16:29
Thomas Dickey
49.1k584154
49.1k584154
Is it possible to do that without restarting xterm? If it involves restarting xterm it is not really an answer as that would cause the output to be lost.
â kasperd
Apr 29 at 17:54
This is what I was looking for. Resources can be reloaded on the fly, and I'm OK to restart xterm. I've created a named fifo and configured it into printerCommand, have bound print-everything command to a key and it works exactly as I wanted it to.
â John Z.
May 18 at 18:18
add a comment |Â
Is it possible to do that without restarting xterm? If it involves restarting xterm it is not really an answer as that would cause the output to be lost.
â kasperd
Apr 29 at 17:54
This is what I was looking for. Resources can be reloaded on the fly, and I'm OK to restart xterm. I've created a named fifo and configured it into printerCommand, have bound print-everything command to a key and it works exactly as I wanted it to.
â John Z.
May 18 at 18:18
Is it possible to do that without restarting xterm? If it involves restarting xterm it is not really an answer as that would cause the output to be lost.
â kasperd
Apr 29 at 17:54
Is it possible to do that without restarting xterm? If it involves restarting xterm it is not really an answer as that would cause the output to be lost.
â kasperd
Apr 29 at 17:54
This is what I was looking for. Resources can be reloaded on the fly, and I'm OK to restart xterm. I've created a named fifo and configured it into printerCommand, have bound print-everything command to a key and it works exactly as I wanted it to.
â John Z.
May 18 at 18:18
This is what I was looking for. Resources can be reloaded on the fly, and I'm OK to restart xterm. I've created a named fifo and configured it into printerCommand, have bound print-everything command to a key and it works exactly as I wanted it to.
â John Z.
May 18 at 18:18
add a comment |Â
up vote
1
down vote
You can always use something like tmux which provides capture-pane that does what you want, along with splits (vertical and horizontal) and multiplexing, session support, and a slew of other things.
Or use a different terminal emulator xfce4-terminal is also lightweight and provides an easy Save Contents
1
To me this does not sound like an answer to the question. None of those programs can magically capture output which at the moment exist only in an xterm window.
â kasperd
Apr 29 at 17:56
@kasperd a fair interpretation. He wants something that captures without pre-thought. I usetmuxwithout prethought. Then I don't have this problem. If you can get in the habit of using tmux, you'll never have to think about this again (or a lot of other stuff).
â Evan Carroll
Apr 29 at 18:10
add a comment |Â
up vote
1
down vote
You can always use something like tmux which provides capture-pane that does what you want, along with splits (vertical and horizontal) and multiplexing, session support, and a slew of other things.
Or use a different terminal emulator xfce4-terminal is also lightweight and provides an easy Save Contents
1
To me this does not sound like an answer to the question. None of those programs can magically capture output which at the moment exist only in an xterm window.
â kasperd
Apr 29 at 17:56
@kasperd a fair interpretation. He wants something that captures without pre-thought. I usetmuxwithout prethought. Then I don't have this problem. If you can get in the habit of using tmux, you'll never have to think about this again (or a lot of other stuff).
â Evan Carroll
Apr 29 at 18:10
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You can always use something like tmux which provides capture-pane that does what you want, along with splits (vertical and horizontal) and multiplexing, session support, and a slew of other things.
Or use a different terminal emulator xfce4-terminal is also lightweight and provides an easy Save Contents
You can always use something like tmux which provides capture-pane that does what you want, along with splits (vertical and horizontal) and multiplexing, session support, and a slew of other things.
Or use a different terminal emulator xfce4-terminal is also lightweight and provides an easy Save Contents
answered Apr 29 at 16:44
Evan Carroll
4,48683472
4,48683472
1
To me this does not sound like an answer to the question. None of those programs can magically capture output which at the moment exist only in an xterm window.
â kasperd
Apr 29 at 17:56
@kasperd a fair interpretation. He wants something that captures without pre-thought. I usetmuxwithout prethought. Then I don't have this problem. If you can get in the habit of using tmux, you'll never have to think about this again (or a lot of other stuff).
â Evan Carroll
Apr 29 at 18:10
add a comment |Â
1
To me this does not sound like an answer to the question. None of those programs can magically capture output which at the moment exist only in an xterm window.
â kasperd
Apr 29 at 17:56
@kasperd a fair interpretation. He wants something that captures without pre-thought. I usetmuxwithout prethought. Then I don't have this problem. If you can get in the habit of using tmux, you'll never have to think about this again (or a lot of other stuff).
â Evan Carroll
Apr 29 at 18:10
1
1
To me this does not sound like an answer to the question. None of those programs can magically capture output which at the moment exist only in an xterm window.
â kasperd
Apr 29 at 17:56
To me this does not sound like an answer to the question. None of those programs can magically capture output which at the moment exist only in an xterm window.
â kasperd
Apr 29 at 17:56
@kasperd a fair interpretation. He wants something that captures without pre-thought. I use
tmux without prethought. Then I don't have this problem. If you can get in the habit of using tmux, you'll never have to think about this again (or a lot of other stuff).â Evan Carroll
Apr 29 at 18:10
@kasperd a fair interpretation. He wants something that captures without pre-thought. I use
tmux without prethought. Then I don't have this problem. If you can get in the habit of using tmux, you'll never have to think about this again (or a lot of other stuff).â Evan Carroll
Apr 29 at 18:10
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440752%2faccess-xterms-scrollback-buffer-as-a-file%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Alternative to using
tee. Have you considered runningscriptto create a log of all your commands to a file?â Stephen Quan
Apr 30 at 0:16