I installed Termux and using the pkg system installed tmux.

However, the tmux that installs doesn't appear to support copying and pasting. I can enter copy mode, but I can't select text and copy it to the clipboard using the spacebar and the enter key. Is there any way to go about this?


Try having this line in your ~/.tmux.conf file:

set-window-option -g mode-keys vi

This enables a set of vi key bindings that seems to work fine. I used the Spacebar and Enter keys to copy that line from within a tmux session running in Termux and pasted it into this textbox in Chrome with Ctrl+v.

| improve this answer | |
  • 1
    Yes that did work! Nice work man. I believe I used CTRL+B, started my cursor with the h, j, k, and L keys pressed enter, and low and behold when I got to the address bar in Firefox I could paste it in! – leeand00 Sep 7 '18 at 18:38
  • Note, I may have used "+y as well.... – leeand00 Sep 7 '18 at 18:38

Unfortunately, tmux can't access Android system clipboard, unlike real GNU/Linux distros. The copy mode is pretty much isolated in tmux, so you can only copy from and paste to within sessions.

To paste from clipboard, long-press (hold) anywhere on the terminal screen and tap "Paste" in the pop-up menu.

To copy to clipboard, long-press some text on the terminal screen. Drag the pins to select the text you want to copy and tap "Copy" in the pop-up menu.

| improve this answer | |
  • I was only trying to access it within the session and copy it between panes and windows. Maybe I wasn't clear about that above. – leeand00 Apr 1 '18 at 9:11
  • if that's all you want to do, you can use files and redirect outputs accordingly. – gcb May 20 '18 at 0:00
  • One unfortunate thing about this is that the Termux pop-up menu pins don't know anything about vertically split panes, understandably, so that requires workarounds if you're trying to copy anything spanning multiple lines. – Jacob Wan Sep 6 '18 at 15:52
  • Correction: I meant it's a problem for text in horizontally split panes. I always get those terms mixed up. For some reason I keep wanting to think it refers to the orientation of the separator between the panes rather than the layout of the panes in relation to one another. – Jacob Wan Sep 6 '18 at 16:14
  • @JacobWan tmux's pane splitting is a good feature, but I don't think it works well on a phone's small screen, so I only use windows but not panes on my phone. For tablets, I admit copying text from splitted screen is a problem. – iBug Sep 7 '18 at 0:46

This answer may be irrelevant to your needs, but I arrived at your post while trying to solve a problem. Unlike with the x windows system, you don't need anything but Termux to paste text. Use "share" on the selected text, share to Termux, then enter a filename as prompted, and tap open folder.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.