I have set up ubuntu-14.10 to boot up in text mode (cli) and I start gui with the command
sudo service lightdm start then toggle between gui and cli mode with
Alt+ctrl+F1 (to get into cli) and
Alt Gr + LEFT ( to get into gui mode).
How can I paste the selected text from gui and toggle to cli mode and then paste it there (especially in
Note- I have tried
ctrl+v but none of them are working. I have modified my
so that it starts tmux inside cosole upon startup. I don't know if this has anything to do with tmux so please guide me?
To my surprise it is actually possible. First some setup:
alias pc='$(xclip -display :0 -out)'.
Now, assuming you've copied some text and changed back to the VT:
What happens in the last step is that the
readline command replaces the command line with the output of the
You may also want to add the alias to your
~/.bashrc for convenience.
* When copying text in Firefox the
xclip command blocks. However, after selecting text in an XTerm window it didn't.
I am not using
You can use the same method to paste into
vim: just type
vim - <<'EOF', press Enter, type
pc, press Ctrl-Alt-e and Enter, and finally run
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.
screensession in TTY1.
Return to GUI. Open terminal emulator. Type
screen -ls to list sessions.
screen -x and the id of the session you found with
tmuxin TTY1. Return to GUI
tmuxsession 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