Thank you for your support. I wish to make a bash script that uses the latest text copied and currently in clipboard.
There are keyboard shortcuts for GUI terminals , Ctrl+Shift+V and Shift+Insert already. A script and mouse are unnecessary here.
If you're specifically looking for commands, there are
xsel. Both of them are used to manipulate clipboards ( of which there are two in Linux - primary and secondary, that's why two different keyboard shortcuts were mentioned in the beginning of this answer ). I am personally more of a
xclip fan, and i regularly use
echo text | xclip -sel clip to copy something to clipboard and
xclip -out -sel clip to print out whatever is in my clipboard. This is especially useful when you want to filter out text or process text with another command like
xclip -out -sel clip | grep 'some text that I am looking for'
xsel don't come to Ubuntu by default. You must install them with
sudo apt-get install PACKAGE_NAME command
If we want to go into TTY, there's no way to copy text there. You must either use something known as
named pipe or just a plain text file.
You can leverage
xdotool for simulating the keyboard and mouse.
So for pasting a text from clipboard we use Ctrl+Shift+v, you can simulate this in
xdotool key ctrl+shift+v
Also check of mouse actions, read
If not installed, install it by (available in the Universe repository):
sudo apt-get install xdotool