3

How do i copy text that includes tab characters from a text editor, let's say gedit into a terminal session on ubuntu/gnome? I am on ubuntu 12.0.4 using gnome classic.

UPDATE This same issue happens in CentOs - basically seems to apply to any gnome.

1

3 Answers 3

2

As I mentioned on the OS X version of this question, pasting tabs works fine. But copying them in the first place is tricky on Linux.

1

There does not appear to be any solution to this.

1
  • Hang on, are you trying to paste into the terminal prompt, or into a text file opened in the terminal? If the former, could you explain why you would need that?
    – terdon
    Jun 19, 2018 at 10:42
0

Just select the text you want to copy, and then middle click on the terminal. On most *nix systems, selecting copies and middle click pastes.

Alternatively, you can select => right click=>copy => terminal => right click=> paste

Or, simply Ctrl+C,Ctrl+V

Have a look here for a short explanation of the Linux/Unix clipboard and the X buffer.

10
  • I neglected to mention the problem focuses on tab characters getting lost. Jun 14, 2013 at 14:38
  • @javadba selecting and middle clicking should copy tabs across correctly. In fact all of them should.
    – terdon
    Jun 14, 2013 at 14:47
  • Tabs definitely get lost with control c: pls test yourself - does "middle click" keep the tabs? i have 2 button mouse only Jun 14, 2013 at 15:00
  • @javadba if you have a two button mouse, you can emulate the middle click by clicking both buttons at the same time. I did try it and both Ctrl+V and Middle click copy the tabs correctly on my system. Are you sure you have tabs there? You can check with od -c file.txt.
    – terdon
    Jun 14, 2013 at 16:27
  • (a) clicking both left and right is not working (b) I usually do not have an external mouse anyways and no middle click on trackpad. So in the end I still do not have a solution. I came back here to my own question via googling over a year later. Jul 25, 2014 at 5:01

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.