Page 1 of 1

URXVT "Select all" ?

Posted: Sun Aug 16, 2020 8:15 am
by greengeek
I sometimes end up with my terminal (URXVT) full of data and want to copy it to a text file.

I know how to copy and transfer the selected (or "highlighted"?) contents but cannot remember how to actually do the selection (highlighting?) in a similar way to "ctrl+A". (including all of the data that is off screen).

I can select and scroll up (lasso?) but sometimes that is way too slow due to the amount of data offscreen so i wondered if anyone knows if there is a shortcut to do this?
cheers!

Re: URXVT "Select all" ?

Posted: Sun Aug 16, 2020 4:05 pm
by 666philb
hi @greengeek
you could start selecting at the bottom (a line or less), then scroll up and 'shift left click' at the top to select all

Re: URXVT "Select all" ?

Posted: Sun Aug 16, 2020 4:34 pm
by 6502coder
In situations where you know in advance that you're going to run a command, or series of commands, that will generate a lot of output to the terminal, the "script" command is useful.

You can find my article on the "script" command in the March 2018 issue of the Puppy Newsletter.

Re: URXVT "Select all" ?

Posted: Sun Aug 16, 2020 4:40 pm
by williams2
It's very easy.

Left-click anywhere you like, top or bottom. This will be one end of the selected text. Select a few letters or a few words, if you like, by holding the left mouse button and dragging the mouse cursor over the text.

Right click anywhere. This will select all the text between there and the start position. You can also right-click and hold the right mouse button and drag the end of the selection anywhere. Right-click again, if you want, anywhere you like.

Scroll up or down anytime you like. You can scroll with the mouse wheel or by dragging the scroll bar at the right or left of the window or hold the shift key down and press or hold the page-up or page down key. Don't click the left mouse button unless you want to reset where the start of the selection is.

A little practice on a screen of text will show you what I mean. Dragging the right mouse button is particularly useful.

Much easier than selecting text in Palemoon or Firefox or geany.

By the way, for newer versions of Puppy, the selected text is copied to the primary buffer (middle-click to paste)
and also to the clipboard buffer (press ctrl+V to paste in Firefox, geany, etc.)

Re: URXVT "Select all" ?

Posted: Tue Aug 18, 2020 8:30 am
by greengeek
Thanks all,

@666philb and @williams2 - I think i have used your stated techniques correctly and both work - although if i am doing this correctly both still require me to scroll the entire terminal, which seems the same as my drag left click method. (Please let me know if that sounds wrong).

I was hoping there was a shortcut that would allow a selection without scrolling but it seems not.

@6502coder - i havent got hold of the newsletter yet - still on the todo list. Will report back once done.

cheers!

Re: URXVT "Select all" ?

Posted: Tue Aug 18, 2020 2:27 pm
by bigpup
Not exactly sure what you are doing with urxvt.

Have you tried to do it using Geany?
Geany is a powerful, stable and lightweight programmer's text editor that provides tons of useful features without bogging down your workflow. It runs on Linux, Windows and MacOS is translated into over 40 languages, and has built-in support for more than 50 programming languages.

Re: URXVT "Select all" ?

Posted: Tue Aug 18, 2020 8:31 pm
by greengeek
bigpup wrote: Tue Aug 18, 2020 2:27 pm Not exactly sure what you are doing with urxvt.

Have you tried to do it using Geany?
Hi Bigpup, when using Geany or Leafpad I can highlight the entire text contents by using shortcut Ctrl+A

However, when i use a terminal (URXVT in my case) and want to try to highlight the entire contents (which is usually something like the error report from some program...) the Ctrl+A shortcut does not work.

I wondered if there was some other shortcut that can highlight the whole contents of the terminal - then i could copy the whole lot with middle click.

Here is an example:

Type into a terminal:
#xrandr --verbose

The result is as follows:

Code: Select all

# xrandr --verbose 
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 8192 x 8192
LVDS1 connected 1280x800+0+0 (0x44) normal (normal left inverted right x axis y axis) 0mm x 0mm
	Identifier: 0x41
	Timestamp:  3002764
	Subpixel:   horizontal rgb
	Gamma:      1.0:1.0:1.0
	Brightness: 1.0
	Clones:    
	CRTC:       1
	CRTCs:      1
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	BACKLIGHT: 7 (0x00000007)	range:  (0,7)
	Backlight: 7 (0x00000007)	range:  (0,7)
	scaling mode:	Full aspect
		supported: None         Full         Center       Full aspect 
  1280x800 (0x44)   68.9MHz -HSync -VSync *current +preferred
        h: width  1280 start 1301 end 1333 total 1408 skew    0 clock   49.0KHz
        v: height  800 start  804 end  808 total  816           clock   60.0Hz
  1024x768 (0x45)   65.0MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock   48.4KHz
        v: height  768 start  771 end  777 total  806           clock   60.0Hz
  800x600 (0x46)   40.0MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock   37.9KHz
        v: height  600 start  601 end  605 total  628           clock   60.3Hz
VGA1 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x42
	Timestamp:  3002764
	Subpixel:   unknown
	Clones:     DVI1
	CRTCs:      0 1
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
DVI1 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x43
	Timestamp:  3002764
	Subpixel:   horizontal rgb
	Clones:     VGA1
	CRTCs:      0 1
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
# 
It forces me to scroll the terminal contents in order to capture that.
(And often there will be pages of information in the terminal output)

I could always force it direct to a text file like this:

#xrandr --verbose > xrandr_output.txt

but that is only useful if i know ahead of time that i will need to save the terminal output.

Most of the time it is not until after i see the terminal contents that i decide i want to save it.

Re: URXVT "Select all" ?

Posted: Tue Aug 18, 2020 10:27 pm
by williams2
It is easy to select test in an urxt window.

Left click anywhere to mark one end of the selection.
Right click anywhere to mark the other end of the selection.

To scroll to the top of the buffer screens. you can use the mouse.
For example, middle clicking the scroll bar at the top will go to the top of the buffer, instantly.
Or you can press the shift+pageup keys to move up one screen.
You can hold shift+pageup until it gets all the way to the top, if you like.

Then right-click to mark the top end of the selection.

It's very easy and fast.

You could write a script that runs if you press a certain key combination, to automatically select the entire screen and all of the scrollback buffer, using xdotool.

Script can be useful.
script --help

For example:

Code: Select all

# script
Script started, file is typescript
# randr --verbose
# echo and any other shell commands
# exit
Script done, file is typescript
Press cntrl+D to stop script
By default, a copy of whatever was printed in the urxvt window will be in the file named typescript.

Edit: By the way, you can select a rectangular area as opposed to a word by word, line by line selection, by holding down ctrl+alt when you make a selection by dragging the left mouse button., which can be sometimes useful.

Edit2: Also, urxvt will auto-scroll. You can drag the mouse over the text on the screen to select it, and if you drag the mouse up to the top of the screen, urxvt will automatically start scrolling. It would be safer to mark the bottom of the selection with the left mouse button, then drag the right mouse button to the top of the window to make it autoscroll.

Re: URXVT "Select all" ?

Posted: Tue Aug 18, 2020 11:34 pm
by Gyle
This is not URXVT but Shift+Ctrl+A works with ROXTerm

search PPM for roxterm
or
http://roxterm.sourceforge.net//index.p ... on&lang=en

Re: URXVT "Select all" ?

Posted: Wed Aug 19, 2020 8:34 pm
by step
I have this in my ~/.Xresources file:

Code: Select all

! Press Print to dump terminal text to the print-pipe command and C-Print or S-Print to include the scrollback buffer as well.
! This creates a new file in your home directory with the screen contents every time you hit "Print".
!URxvt.print-pipe: cat > $(TMPDIR=$HOME mktemp urxvt.XXXXXX)
URxvt.print-pipe: cat > $(date +$HOME/urxvt-%FT%T,%N%z)
(! is the comment character.) So when I press control-print key in urxvt all visible text + all scrollback buffer text is copied to a time-stamped file in my home directory. Another useful setting is

Code: Select all

URxvt.saveLines: 8192
This sets the size of the scrollback buffer to 8192. It may seem like a lot, but if you do a lot of compiling it's easy to exceed even that many lines.

To test these values you need to add the relevant settings to your ~/.Xresources file, then run xrdb -load ~/.Xresources and start a new urxvt terminal.

If you run the terminal daemon, urxvtd -- most likely you don't run urxvtd -- you will need to restart that before reloading ~/.Xresources, then restart the daemon and open a new terminal window. So you will need a non-urxvt side terminal to carry out this operation. I use xterm but the geany terminal plugin will do just as well.

Be wary that the comments inside ~/.Xresources are oversensitive to single quotes and a few other combinations.

Re: URXVT "Select all" ?

Posted: Thu Aug 20, 2020 12:32 am
by greengeek
step wrote: Wed Aug 19, 2020 8:34 pm ...So when I press control-print key in urxvt all visible text + all scrollback buffer text is copied to a time-stamped file in my home directory.
Thanks step - can you clarify control-print please? Is that Ctrl+P or do you mean Ctrl+Prtsc? I could not get either to work.
cheers!

Re: URXVT "Select all" ?

Posted: Thu Aug 20, 2020 12:37 am
by greengeek
6502coder wrote: Sun Aug 16, 2020 4:34 pm In situations where you know in advance that you're going to run a command, or series of commands, that will generate a lot of output to the terminal, the "script" command is useful.
williams2 wrote: Tue Aug 18, 2020 10:27 pm Script can be useful.
script --help
Thank you both. Unfortunately it turns out that my Slacko 5.6 derivative does not recognise the "script" command. Oh well, still other options yet to be tested...

Re: URXVT "Select all" ?

Posted: Thu Aug 20, 2020 4:02 pm
by 6502coder
script.zip
Rename to remove fake ".zip" extension
(14.09 KiB) Downloaded 25 times
In my Newsletter article I acknowledge that "script" is not found in most Puppies, and that is why the article includes the instructions for compiling it from source.

If you are willing to trust me, I've attached the compiled executable I use myself. I believe I compiled it on Puppy 4.1.2, and it for sure works on SailorE's Slacko5.8, so it should work for you.

Just rename the file to remove the fake ".zip" extension and put it anywhere in your PATH, such as ~/my-applications/bin

Remember to make it executable with "chmod +x script" if necessary.

Re: URXVT "Select all" ?

Posted: Mon Aug 24, 2020 1:14 pm
by step
greengeek wrote: Thu Aug 20, 2020 12:32 am
step wrote: Wed Aug 19, 2020 8:34 pm ...So when I press control-print key in urxvt all visible text + all scrollback buffer text is copied to a time-stamped file in my home directory.
Thanks step - can you clarify control-print please? Is that Ctrl+P or do you mean Ctrl+Prtsc? I could not get either to work.
cheers!
I mean control-PrintScreen. If it doesn't work for you with my instructions, maybe your urxvt version is too old to support this feature. My urxvt version is 9.22.

Re: URXVT "Select all" ?

Posted: Tue Aug 25, 2020 8:52 am
by greengeek
6502coder wrote: Thu Aug 20, 2020 4:02 pm script.zip
If you are willing to trust me, I've attached the compiled executable I use myself. I believe I compiled it on Puppy 4.1.2, and it for sure works on SailorE's Slacko5.8, so it should work for you.
Thanks for the script. Interesting results so far. Sometimes "typescript" appears as a text file but at other times it seems to appear as an "octet stream" that geany can't open. More testing later.

Re: URXVT "Select all" ?

Posted: Tue Aug 25, 2020 8:53 am
by greengeek
step wrote: Mon Aug 24, 2020 1:14 pm maybe your urxvt version is too old to support this feature. My urxvt version is 9.22.
Hmmm, i realise i don't know how to find the version of urxvt. How is that done please?

Re: URXVT "Select all" ?

Posted: Tue Aug 25, 2020 9:07 am
by dogFellow
discovered the
tee
command the other day

eg..

/root/gpptp-stuff/vpnbook/gpptp-code.sh | tee texth.log

what it does is output stuff that is displayed in a terminal to a file. in the above code the output goes to file texth.log
from https://easyos.org/forum/showthread.php ... 307#pid307

Re: URXVT "Select all" ?

Posted: Tue Aug 25, 2020 11:43 am
by bigpup
i realise i don't know how to find the version of urxvt. How is that done please?
In a terminal:

Code: Select all

urxvt -help

Re: URXVT "Select all" ?

Posted: Tue Aug 25, 2020 2:44 pm
by HerrBert
step wrote: Wed Aug 19, 2020 8:34 pm I have this in my ~/.Xresources file:

Code: Select all

! Press Print to dump terminal text to the print-pipe command and C-Print or S-Print to include the scrollback buffer as well.
! This creates a new file in your home directory with the screen contents every time you hit "Print".
!URxvt.print-pipe: cat > $(TMPDIR=$HOME mktemp urxvt.XXXXXX)
URxvt.print-pipe: cat > $(date +$HOME/urxvt-%FT%T,%N%z)
(! is the comment character.) So when I press control-print key in urxvt all visible text + all scrollback buffer text is copied to a time-stamped file in my home directory. Another useful setting is

Code: Select all

URxvt.saveLines: 8192
This sets the size of the scrollback buffer to 8192. It may seem like a lot, but if you do a lot of compiling it's easy to exceed even that many lines.

To test these values you need to add the relevant settings to your ~/.Xresources file, then run xrdb -load ~/.Xresources and start a new urxvt terminal.

If you run the terminal daemon, urxvtd -- most likely you don't run urxvtd -- you will need to restart that before reloading ~/.Xresources, then restart the daemon and open a new terminal window. So you will need a non-urxvt side terminal to carry out this operation. I use xterm but the geany terminal plugin will do just as well.

Be wary that the comments inside ~/.Xresources are oversensitive to single quotes and a few other combinations.
In Slacko 6.3.2 settings seem to be located in ~/.Xdefaults (no need to reload - just close all instances of (u)rxvt and open a new one)

Slacko 6.3.2 has urxvt v9.21

Very helpful...

Re: URXVT "Select all" ?

Posted: Sun Aug 30, 2020 9:23 am
by greengeek
bigpup wrote: Tue Aug 25, 2020 11:43 am
i realise i don't know how to find the version of urxvt. How is that done please?
In a terminal:

Code: Select all

urxvt -help
Thanks Bigpup, here are my results:

Code: Select all

# urxvt -help
rxvt-unicode (urxvt) v9.05 - released: 2008-06-15
Looks like i may have too old a version of URXVT

HerrBert wrote: Tue Aug 25, 2020 2:44 pm In Slacko 6.3.2 settings seem to be located in ~/.Xdefaults (no need to reload - just close all instances of (u)rxvt and open a new one)
Thanks - i gave this a try but still no joy for me unfortunately.

Re: URXVT "Select all" ?

Posted: Sun Aug 30, 2020 1:58 pm
by mikeslr
:idea: I solve all urxvt problems by installing lxterminal (AFAIK available for any post 2010 Puppy) or occasionally roxterm.

Re: URXVT "Select all" ?

Posted: Mon Aug 31, 2020 8:32 am
by greengeek
mikeslr wrote: Sun Aug 30, 2020 1:58 pm :idea: I solve all urxvt problems by installing lxterminal (AFAIK available for any post 2010 Puppy) or occasionally roxterm.
Thanks Mike - on your recommendation i just tried installing lxterminal but still don't see a keyboard shortcut that selects all of the contents. What method do you use to copy all text that is on and offscreen within lxterm?

Re: URXVT "Select all" ?

Posted: Mon Aug 31, 2020 2:42 pm
by mikeslr
greengeek, " What method do you use to copy all text that is on and offscreen within lxterm?".

Written b4scoc (before second cup o coffee): Basically, I select text the same way as when using text editors/word-processors: Hold down Left-mouse while dragging it over the desired text. That selects it. Menu>Edit>Copy copies it to the clipboard. From there I can use any application's "paste" mechanism.

But perhaps I should have read this thread from the beginning before tossing in my 2 cents. If you are looking for an entirely keyboard solution (no-mouse) there may not be one with lxterminal. I didn't do an exhaustive search --hard to find discussions just about 'lxterminal'-- but one responder suggested using tmux. https://www.raspberrypi.org/forums/view ... p?t=120393

ASCOC (after 2nd cup of coffee). Search results not much different except that I found this extensive article about "Copying text from a terminal" on Archlinux.org, https://wiki.archlinux.org/index.php/Co ... a_terminal. Both urxvt and xterm (which AFAIK is built into all Puppies) are discussed. Urxvt requires an extension. Xterm requires a work-around. The article, however, doesn't discuss a "no-gui" method, and tmux isn't mentioned at all. IIRC, rufwoof has often mentioned his use of tmux.

Re: URXVT "Select all" ?

Posted: Mon Aug 31, 2020 7:47 pm
by greengeek
mikeslr wrote: Mon Aug 31, 2020 2:42 pm
Written b4scoc (before second cup o coffee): Basically, I select text the same way as when using text editors/word-processors: Hold down Left-mouse while dragging it over the desired text. That selects it.
Thanks mike - yes i can do this the same way - but in a text editor or word processor i am also in the habit of using Ctrl+A to "select all" and i thought this would have worked within terminal too but it does not.

Click and drag/scroll across text does work in URXVT but is a lengthy process if the terminal has captured acres of content.

Will have a closer look at what tmux is about.

EDIT: looks as if tmux is even more complicated than click/drag/scroll. Probably slower too. It may have some benefits when trying to capture an exact region within complex text or ascii characters but as far as i could see did not allow a quick solution for "select all" unfortunately.

Re: URXVT "Select all" ?

Posted: Mon Aug 31, 2020 8:05 pm
by greengeek
dogFellow wrote: Tue Aug 25, 2020 9:07 am discovered the
tee
command the other day
eg..
/root/gpptp-stuff/vpnbook/gpptp-code.sh | tee texth.log
what it does is output stuff that is displayed in a terminal to a file. in the above code the output goes to file texth.log
Thanks dF - just tried this in Bionic64 and confirmed working. Although i feel this is much the same as:

command > output.txt

unless there is maybe some extra benefit in tee (or the pipe syntax) that i missed?

Re: URXVT "Select all" ?

Posted: Mon Aug 31, 2020 8:06 pm
by williams2
Again: To select, for example, all of the text in a urxvt window, and all of the scroll buffer, you can:

1) Left click at the bottom of the selection.

2) Scroll up to the top, by pressing and holding shift+PageUp

3) Right click the other end of the selection, at the top.

You can right-click as many times as you like, and/or drag the mouse cursor with the right mouse button, if you like.

Very fast, very easy.

Or you can middle-click the urxvt scroll bar to instantly get to the top.

Re: URXVT "Select all" ?

Posted: Mon Aug 31, 2020 8:13 pm
by greengeek
williams2 wrote: Mon Aug 31, 2020 8:06 pm Again: To select, for example, all of the text in a urxvt window, and all of the scroll buffer, you can:

1) Left click at the bottom of the selection.

2) Scroll up to the top, by pressing and holding shift+PageUp

3) Right click the other end of the selection, at the top.
Ahhhh, right. Finally you succeeded in getting it hammered into my head :lol: :lol: :lol:

Seeing it as shift+PageUp somehow triggered a neuron this time and i actually read it properly.
Or you can middle-click the urxvt scroll bar to instantly get to the top.
Another good tip. Thanks!!
:thumbup2:
(EDIT : this last tip did not work for me in Bionic64. More testing on other pups to follow)
(EDIT2 : Oh yes it does work - but what you meant was "middleclick at the TOP of the scrollbar")

Re: URXVT "Select all" ?

Posted: Tue Sep 01, 2020 7:13 pm
by williams2
If you are running BionicPup64 then the printscreen button should work.

I think my BionicPup64 is configured by default to put the urxvt text in a pdf file.

You can configure it to copy the text to a txt file, by following the instructions in previous posts.

You can do it this way, if you like:

1) Create a new shell script somewhere, for example in /root, by right-clicking the dir in Rox
and selecting "New", "Script"
You could name it, for example, urxvt2txt.sh

2) Right-click urxvt2txt.sh, select "Open as text" and put something like this in the file:

Code: Select all

#!/bin/sh
cat > /root/vt$$.txt
notify-send "urxvt text pasted to file vt$$.txt"
3) Edit the hidden file .Xresources in /root and add this line:

Code: Select all

URxvt.print-pipe: /root/urxvt2txt.sh
4) Reboot, or restart X, or type this in a text terminal:

Code: Select all

xrdb -merge ~/.Xresources
and it should work.

Pressing the prt-sc (print-screen) key in an urxvt should copy the text to a file in /root
Pressing ctrl+prt-sc should copy all of the text, including the scroll buffer text.

By the way, it would be safer to use a date rather than the pid number, for example "date +%s"

Re: URXVT "Select all" ?

Posted: Tue Sep 01, 2020 8:09 pm
by dogFellow

Code: Select all

# xrandr --verbose > /root/urtext.txt