I have a CentOS 8 minimal install. There is no GUI. If I am on the console, say I have typed out a command, such as nice-command-with-switches-that-does-stuff that I am happy with. Now, I want to either to select all or part of this line that is on the console so that I can then vi script.sh and then to paste this information at a location that I want within the script.
Obviously, doing echo 'nice-command-with-switches-that-does-stuff' >> script.sh could work but only if I want the text at the end of the file (and that's not always the case).
Is there a generic way that I can selectively mark some text on the console where I am working and store it in a buffer/clipboard to use elsewhere (such as inside vim or nano or some other editor), and in the opposite direction, could I yank some text while inside vi that I could then keep until I am pluck outside of vi and then paste that onto the console?