I'm trying to write a bash-script that resizes my KDE-Konsole terminal-window when started. But I can't get it to work. VT-Terminal-codes don't seem to work properly.

$ echo -e "\e[8;2;20t" shrinks the used area of the terminal-window correctly, but leaves the window-size unchanged.

Is there any way to shrink the Konsole-window with a bash-script?


No, there is not.

First, what makes you think that these are DEC VT escape sequences? A real terminal doesn't have a GUI window around it that can be resized.

What these are are escape sequences recognized by the dtterm terminal emulator, for window management, which the xterm terminal emulator supports for compatibility.

The konsole terminal emulator only supports supports some of what xterm supports. It is not fully xterm-compatible let alone dtterm-compatible. Specifically, in this case, it supports CSI 8 ; H ; W t, but not CSI 4 ; H ; W t.

Further reading

  • 1
    okay. so there is really no way of resizing a window? my question was not necessarily limited to escape-sequences. – sloewen Mar 9 '14 at 22:44

You can use xdotool. I got it with apt-get install xdotool in Ubuntu.

The basic command may be something like:

xdotool windowsize `xdotool search Konsole` 60% 50%

This is only a starting point, far from being foolproof (e.g. if xdotool search Konsole doesn't return exactly one number then the outer command will break). Modify and expand it to your needs. In case you are not familiar with backtick, follow this link.

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.