Search code examples
terminalcopy-pastetmuxwindows-subsystem-for-linux

Copy and Paste from Tmux window running inside a terminal on Windows WSL/WSL2


I have been looking for ways to do this for some time: how do I copy text from my Tmux pane - running inside a windows WSL or WSL2 ubuntu (or other linux distro) terminal - to other windows or WSL-Linux applications. I googled this in the past, and I couldn't find a simple solution. I found a ton of complex suggestions none of which worked (and I certainly didn't have the time to turn that into a time consuming project). How can I instruct .tmux.conf to expose its clipboard to the windows clipboard? I can't believe this is so complicated.


Solution

  • I am not sure if this answer is what you are asking for, as I have faced a similar problem yesterday and still today - and I have come to the conclusion that most probably only those with a demoniac intelligence and a lot of free time on their hands are able to tweak Tmux and achieve the goal elegantly.

    Having said this, I have found a workaround that works for me, inspired by how I was able to do copy&paste on MS-DOS terminals in Windows in the past.

    A picture is probably worth one thousand words here: enable copy on the Windows Ubuntu terminal. Also works when running Tmux

    Click on the top left icon, Edit -> Mark, select text to copy. Press Enter (or Click on the top left icon again and go for Edit -> Copy)

    It did the job for me.