Super short post. This may not be a surprise if you’re an Emacs user, but in my circles people use Vim and we discovered this just today. You can cut & paste in the command line, like this:
Cut to the end of the line with
Ctrl+Kand paste at the cursor position with
There are more options than just
Ctrl-Y. Browse the documentation of Bash and search for kill and yank which are the terms used there for cut and paste, and the reason why the keys are K and Y.
I’ve needed to swap parts of a command line many times in my life and I always found it difficult. I usually combined the GUI selection clipboard with manually deleting a part of the line. I’m glad to have learned this today.