In an interactive shell session, how do I copy to clipboard text that was cut with Ctrl+U? Without using the mouse, obviously. Thus making it available for other GUI applications, instead of pastable only with Ctrl+Y only in the terminal where the Ctrl+U was issued.

Update: added bash tag to cover answers involving bash-only solutions.

  • You get your binding to run xclip or similar. – Ignacio Vazquez-Abrams Feb 9 '18 at 22:35
  • ^Y does not remove text; it yanks what was last killed and "pastes" it. Did you mean ^W, ^U, ^K, M-D, and the like? – DopeGhoti Feb 9 '18 at 22:40
  • Thanks, DopeGhoti. That was a strange mistake. I updated my post. – argle Feb 10 '18 at 8:57
  • I don't think readline has that capacity. Bash does. Do you want this in bash or in some other program? – Gilles 'SO- stop being evil' Feb 10 '18 at 9:02
  • @Gilles Bash is absolutely fine. – argle Feb 10 '18 at 9:03