I use xubuntu 14.04, 64 bit. Every now and then, when I try to paste some text in xfce4-terminal, instead of the expected text to be pasted, it is surrounded by 0~ and 1~, such as:

0~mvn clean install1~

The text is supposed to be mvn clean install -- I verified this by pasting the content in various other applications (gnome-terminal, gedit and others). Every application pastes correctly the content, except xfce4-terminal. I couldn't find any references for this on the internet (unfortunately, it is hard to search for text with special characters on google.com...). Why does this happen?

  • How are you pasting? Middle click, or something else?
    – Celada
    Commented Apr 15, 2015 at 0:02
  • 3
    I've tried every method: middle click, right click and chose option paste, ctrl+shift+v. When the 0~ and 1~ characters appear, it does not matter which pasting method I use. Commented Apr 15, 2015 at 10:38

6 Answers 6


The issue is that your terminal is in bracketed paste mode, but doesn’t seem to support it properly. The issue was fixed in VTE, but xfce4-terminal is still using an old and unmaintained version of it.

You can try temporarily turning bracketed paste mode off by using:

printf "\e[?2004l"
  • 4
    If you can’t always reproduce it it might be that you were running some program that enabled bracketed paste mode and then it crashed, thus wasn’t able to disable it before exiting.
    – remmy
    Commented Apr 16, 2015 at 13:46
  • 6
    Awesome, thanks! I've been struggling with this issue for more than a year. Is it possible to disable this "bracketed paste mode" completely? BTW, who implements such crazy things? ;) Commented Apr 13, 2016 at 13:00
  • 4
    it depends on your terminal. And it is a really useful feature, since it lets applications know whether something was typed in or pasted. For one, weechat, an IRC program, uses it to ask if you want to send multi-line pastes, which it couldn't do without bracketed paste mode, since then there would be no way to know if the user typed the lines or not.
    – remmy
    Commented May 4, 2016 at 10:42
  • 3
    For distributions based on Ubuntu you can try to install patched version of 'vte' package from launchpad.net/~adrozdoff/+archive/ubuntu/vte Commented Oct 21, 2017 at 21:22
  • 3
    Great solution, but when I tried to run 0~printf "\e[?2004l"1~, it told me -bash: 0~printf: command not found. ;) Commented Oct 8, 2020 at 16:20

My issue was due to a badly-closed bash session. So running command reset in my terminal solved it immediately.

  • For me, this does not work. printf "\e[?2004l" works. Terminal: zoc terminal, system: CentOS.
    – jdhao
    Commented Feb 1, 2021 at 6:30
  • This problem happened to me inside of a tmux session. I had to detach from tmux first (CTRL+B D) and run reset from the regular session. This fixed the problem even in the tmux session. Commented Jul 3, 2022 at 9:59

I had the same issue, it occurs after I use vi.

Mine was resolved by adding set t_BE= to my .vimrc file.

For reference, this is what t_BE does:

t_BE enable bracketed paste mode


This behavior occurs when the terminal emulator is stuck in bracketed paste mode.

This typically happens when an application exits uncleanly (crashes or is buggy).

Another reason for the phenomenon to occur frequently is a bug in older versions of VTE (VTE is the terminal emulation widget under gnome-terminal and xfce4-terminal and many more) which is triggered by certain actions in certain utilities such as toggling the panels in Midnight Commander.

To see if this bug is fixed in the VTE-based terminal emulator you're running: Execute echo -ne '\e[>c', this will insert a few characters as if you typed them. If the middle number is 3602 or bigger, the aforementioned old VTE bug is no longer present for you. If the number is smaller than that, VTE is still affected and gets stuck in bracketed paste mode more often than it should.

To see if a certain terminal emulator is fixed in a certain Ubuntu distribution, check its dependencies on packages.ubuntu.com. libvte-2.91-0 is good. libvte-2.90-9 is only good if the actual version of that package is 0.36.2 or newer, and libvte9 is bad. In particular, xfce4-terminal is buggy in Xenial, and fixed in Zesty.


This may not apply directly to your problem, but I found this symptom to probably, in my case, be caused by my editor-of-choice 'mcedit' (Midnight Commander)

To alleviate the bug problem, I added the following function to my .bashrc file:

### vvv 'function mcedit' is a fix-up for the ~0/~1 paste problem
function mcedit() { command mcedit $@ ; printf '\e[?2004l' ; }

Then 'source .bashrc'

Now every time I execute 'mcedit', it automatically adds the 'printf "\e[?2004l"' when I close out to reset the "Bracketed Paste Mode"

Works for me, YMMV.

The same approach can be used with vi, vim, nano, or any other misbehaving program.


There is an additional way that this problem can manifest. Readline's .inputrc file can contain the following:

set enable-bracketed-paste On

This is not fixed by any of the above methods and has eluded me for months. Removing this line or setting

set enable-bracketed-paste Off

will fix this nicely.

You must log in to answer this question.

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