This question already has an answer here:
Is there any way to copy current command (line typed in bash prompt) in terminal to X-clipboard without involving a mouse?
Yes, first you have to install xclip.
Then to copy previous line:
To Paste: Middle click or
To copy Output of any command:
However, this may fail if the command has special characters.