$ cat test.txt
$ xclip test.txt

Pasting the content in an email in Thunderbird will result in

a b

Any idea why?

I'm running Arch Linux (64-bit) and I paste the code via a mouse wheel click (though I also tried CTRL+V without having any luck).

Pasting something for example in Libreoffice keeps the new line characters. I have no idea why it does not work in Thunderbird. I also tried Windows convention line breaks and it still was not correct in Thunderbird.

  • Please provide more information: e.g., what operating system you're running, and what you're doing that results in the (undesired) a b output. Is this a mouse action or a keyboard shortcut (e.g., Ctrl+V), or are you talking about running xclip to paste the clipboard? Are you using a command like echo `xclip` or echo $(xclip)? If you are, try adding quotes: echo "$(xclip)". Oct 24, 2014 at 20:43
  • @don_crissti unfortunately the command did not work. Oct 24, 2014 at 20:57
  • @G-Man I edit my question and included the information you requested. Adding quotes did not work unfortunately. Oct 24, 2014 at 21:01

1 Answer 1


From what I tried, it seems that I can not reproduce your issue of joining short lines. The text gets pasted or inserted always with the newlines.
Pasting the clipboard with Ctrl-V works, pasting the selection with the middle mouse button works too.

But your actual problem to solve may* be to paste a section of text as a citation, keeping the line formating.

To handle that case, there is a secial variant of pastin in thunderbird to do just that: In the "Edit" menu, or the context menu, there is "Paste as Quotation". That pastes lines prefixed with >, and leaves the line breaks alone.

The text pasted is the content of the clipboard. In X, there are multiple buffers for cut and paste. Normally only two, "clipboard" and "primary" are used.

Your command

xclip test.txt

Puts the content of test.txt into the "primary". If you want to directly paste it as quotation, you can modify the command to put the text into the clipboard:

xclip -selection clipboard test.txt

*) It's an interpretation of the question and may be not the case - I see that the question is technically asking why the new lines are lost, not how to change that.

  • I seem to have two clipboard buffers. One that I can access using Ctrl-V/Ctrl-C and one that I can access by just selecting some text (which copies the selection) and by pressing the mouse wheel (pasting). The paste as quotation option seems to access the Ctrl-V/Ctrl-C buffer which is the "wrong" buffer since xclip copies into the other buffer. Did you try it with xclip and it worked for you? Apr 27, 2015 at 8:06
  • Yes, sure - the clipboard is sparate from the selection in X. (There are even more buffers, normally not used) There are some words on it in the man page of xclip. Apr 27, 2015 at 8:12
  • Yes, I used xclip - seems what you want to use is xclip -selection clipboard test.txt? (Side note: do not call files test - it will bite you one day... (because of confusion with the shell builtin test)) Apr 27, 2015 at 8:13
  • 1
    Related: superuser.com/questions/200444/… unix.stackexchange.com/questions/84246/… unix.stackexchange.com/questions/69111/… (Don't even try to understand the full picture of the X clipboards - it's a can of worms) Apr 27, 2015 at 8:19
  • I tried the command xclip -selection clipboard test.txt and it indeed copied into the Ctrl-V/Ctrl-C buffer but the problem remains the same. The line breaks get lost both when using Ctrl-V and when using "paste as quotation". This is very strange. Again if I paste into libreoffice for example it works. Apr 27, 2015 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .