I am using Terminal or iTerm (iTerm2). Let's say I've typed in a command but haven't hit enter yet. Or maybe I used the up arrow to navigate through my command history. How do I copy the current command to the MacOS clipboard? But I also don't want it to include the prompt. Is there a keyboard short cut to do this?
For example, let's say the terminal is showing this:
myhostname:Documents kevuser$ mkdir cool_directory_name
What is the keyboard shortcut to copy mkdir cool_directory_name
to the Mac OS clipboard? Can I add that functionality somehow? It feels like every time I try to copy the whole line it includes the prompt part of the terminal, myhostname:Documents kevuser$
, which I don't want to be copied and pasted.