Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I recently set up a ubuntu 12.04 64 bit machine. I use tmux with many open windows, all of them use zsh as shell, some of them through a chroot environment that uses the same home folder of the normal environment.

After some time doing random commands in the shells (all kinds, but mostly file operations, vi, build/make commands within and without the chroot environment), each shell starts showing immediately some pre-compiled commands from the past history, which I need to remove, eg with Ctrl-Q, before I can type anything or search my previous history.

The extra annoying fact is that if I type by mistake any characters leading the pre-compiled command, then delete the line and type my own command, at the next prompt I'll get also those extra characters. This modified input then grows and grows, without ever appearing in the zsh history file.

If I delete the .zsh_history file, or create a new shell, the problem is solved for a very short time and then inexorably comes back to haunt me after a short while (few minutes of usage of the shell).

This is an example of what my prompt looks like after some time, just coming back to the shell from my previous command:

[10:59:14] user:Build git:(master*) $ schroot -c full32 -- antls -l

Note that the prompt should end obviously at $, and what follows ant is some garbage that I typed by mistake before deleting the line with Ctrl-Q in a previous occurrence.

For context, I'm using oh-my-zsh with the geoffgarside theme and the gitfast plugin. For chroot I'm using schroot with the following configuration:

description=Full 32bits dev environment

I'm at my wits' end and I couldn't find any problem like this described here or elsewhere. Any clue on what can be causing this annoying behavior?

share|improve this question
add comment

1 Answer 1

I suppose you are using the emacs keymap (via d'oh-my-zsh or some custom config)... please check with

$ bindkey | grep '\^Q'
"^Q" push-line

And then... the push-line widget is exactly designed for the purpose you describe as annoying: I type a long command -- but I've forgotten some step... so I initiate push-line via CTRL-Q, I get a new prompt, make it good and after that I get back my previously typed (but not yet executed) command:

$ `cp /something/foo/bar to/another/long/path`  # to/another/long/path does not exist
$ mkdir to/another/long/path
$ `cp /something/foo/bar to/another/long/path`  # appears again and I can execute it via [ENTER] without retyping

So, long story cut short:

Either use CTRL-U which is the default binding for kill-whole-line or redefine CTRL-Q if you are used to that shortcut:

$ bindkey '^Q' kill-whole-line
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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