Selecting forty lines of terminal output by dragging is a small misery. On a Linux desktop with X11, xclip takes them from a pipe.
sudo apt install xclip
xclip -selection clipboard < ~/.ssh/id_ed25519.pub
journalctl -b -p err | xclip -selection clipboard
The -selection clipboard part matters. By default xclip uses the primary selection, which is the one you paste with the middle mouse button, so Ctrl+V gives you something else and you think it failed.
To print what is on the clipboard, add -o:
xclip -selection clipboard -o
I’d make a short alias for the long form, since nobody types it with joy. -rmlastnl is worth knowing too: it drops a final newline, which stops a pasted command from running before you’ve looked at it.
xclip stays in the background to serve the text until something else takes over the clipboard, so don’t be surprised to see the process. It needs a graphical session: over a plain SSH login there is no display to talk to. And on a Wayland desktop use wl-copy instead. Be careful with passwords, since clipboard managers like to remember them.
Further reading: xclip(1) manual page
Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more