When I connect to Android using "adb shell" and run certain commands such as "vim" or "mc", they are restricted to a "window" of 25x80 characters. Since I'm connecting from a desktop computer where xterm has a much higher resolution, I'd like to use it.

How do I resize this console window to e.g. 60x156 characters?


The answer is

stty rows 60 cols 156

A follow-up question is how do I determine the size of my xterm I'm connecting from so that I can pass it to stty automatically (using a script)?

  • Great that you found the solution to your own problem. Don't forget to "accept" it when you are able. However, don't include another question; this isn't a discussion forum. You should open a new question. If it's related you can link to this one from the new question.
    – ale
    Oct 26 '11 at 20:40
  • 2
    Is there a way to tell the android shell to resize automatically to fit the screen size? Similar to the way it's done on other terminals in Unix? Apr 6 '13 at 20:19
  • 1
    i tried this, but it said "/system/bin/sh: stty: not found"... does it have to be installed or something?
    – Brad Parks
    Sep 24 '13 at 13:44
  • 2
    For those who dont know BuxyBox: BusyBox is an app. that has a lot of common unix tools "inside" of it - it's particularly designed for embedded systems. To try it install BuxyBox app on your rooted android. Oct 10 '13 at 18:19
  • 1
    How make this permanent?
    – JohnyTex
    Aug 4 '17 at 9:27

Typing resize after connecting to the device works for me:

shell@android:/ $ resize

If you're on a recent release of Android that uses mksh you can simply do:


Using mksh, I had to run eval $(resize).

The resize command outputs the shell commands COLUMNS=#;LINES=#;export COLUMNS LINES; to stdout, but it does not actually execute them. For that, you can use eval and put it in your .profile or shell rc file. While you're in there, you can add an alias for easy resizing after the actual window is resized.

$ grep resize ~/.profile
eval $(resize)
alias rsz='eval $(resize)'
  • 1
    You shouldn't have to eval the result. resize by itself just works (it does the proper ioctls) Feb 26 '16 at 23:54

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.