Wrap up
Try with a clipboard like xclip. If that does not work, try the Alacritty shortcuts.
terminal plugin: Tmux + clipboard
Install Tmux and a clipboard like xclip or xsel:
sudo apt-get update -y
sudo apt-get install -y xclip
and put this in your ~/.tmux.conf to bind y to the xclip copy:
bind -T copy-mode-vi y send -X copy-pipe "xclip -selection c"
Open the Terminal or Alacritty or whatever terminal you have, Tmux commands should now work. With the Tmux shortcut Ctrl+B-->[, you can start marking whatever you want with Space and then Arrows or picture up/down. After you marked all of the needed text, press y that you bound to "copy to xclip". That makes it possible to copy anything, no matter what size.
Alacritty
With the mouse-scrolling selection in the "Alacritty" terminal (or use right click to mark the end), and Ctrl
+Shift
+C
for copy, it worked. This has nothing to do with the editor you use (less, vim or whatever), since the output of the editor is embedded in the terminal text in "Alacritty". You can also zoom out in "Alacritty", then you can copy all of the text without scrolling.
You can also try the vim mode: press Ctrl+Shift+Space, you can then move through the console history and mark what you need, if you need all, type the vim command ggVG, afterwards, you can paste it in a text file and then back in terminal, you get out of the vim mode by pressing Ctrl+Shift+Space again.
Story (Alacritty)
I needed to do this as well on an old legacy server that I entered using ssh, to get quite a few pages of log text of a file copied to my system. I wanted this to be done without sending that file around, just with the clipboard.
xclip
gives: Sorry, command-not-found has crashed!
so that I cannot use less myfile | xclip
.
When opening the file in vim that is installed (outdated 2012 version), checking :version
, I see -clipboard
and -X11
, so that I cannot copy to the system clipboard:

I can mark text with the mouse, holding shift, and copy with the right-click menu of the terminal, yet, I cannot scroll while doing so, so that I cannot copy many pages of text in one go.
I then got the hint to use a terminal called "Alacritty" to ssh into the server. And yes, this program has the advantage that it shows the opened text file together with the code that opened it so that you do not have a new vim window. In other words: you keep the vim text in the terminal even if you quit vim again. That again gives you the chance to use terminal tools that you do not have in vim, which in "Alacritty" are also to use the mouse for marking and scrolling at the same time. I can therefore press G
as the vim key to get to the end of the file (only then, it is also loaded in the terminal text), then scroll back or type :1
, mark item 1 of the first line of the file, hold that marking mouse-click, and scroll down to the end so that everything is marked just with the mouse (copying will not work when using vim keys like ggVG
), then press Ctrl
+Shift
+C
and paste it in my system.
You can also zoom out in "Alacritty", then you can copy all of the text without scrolling.