How can I paste the selected text from gui and toggle to cli mode and
then paste it there (especially in vim)?
If your goal is to go directly from GUI to TTY and paste, that's impossible. You have to have something in the middle, something in common between tty and gui.
Terminal multiplexers such as
byobu allow creating shared sessions. That means, if you run
screen in graphical terminal emulator, then login to TTY1 and attach yourself to the shared session, everything you type in GUI will show up on TTY1 as well.
The two terminals will behave as one
Note: taking screenshot form TTY is difficult, so for demonstration purposes I will create shared session between two GUI terminals.
Of course, the 3 multiplexers don't come with Ubuntu by default. If you want to get either one, install them with
sudo apt-get install app-name. Note, that installing
byobu gives you all 3 together.
screen session in TTY1.
- Press Ctrl+a, then :. type
Return to GUI. Open terminal emulator. Type
screen -ls to list sessions.
screen -x and the id of the session you found with
Now you should have 2 shared
tmux in TTY1. Return to GUI
- Open terminal emulator.List sessions with
- Attach GUI
tmux session to TTY1 session with
tmux new-session -t X , where x is the number of the TTY1 session.
Simply open byobu session in TTY1 and then go to GUI and open another byobu. They attach automatically.
Sources and Suggested Reading
Share existing tmux session
GNU Screen Splitting
HowTo Share A Terminal Session Using Screen