Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So adb shell has an annoying bug where it doesn't realize that your graphical terminal app is larger than 80x24, so when you try to run any kind of full-screen console apps like vi or emacs (or any ncurses app), it does not take up the full screen, only a small portion of it. Is there a way to fix this easily?

share|improve this question
See for an easy to implement alternative. – Code-Read May 31 at 20:34
up vote 6 down vote accepted

UPDATE (Feb. 2015): By now, you can just use "phablet-shell". No need to fiddle around with self built scripts any more. That said, if you want to, they should still work.

What I usually do is to use ssh instead of adb. That one configures the terminal properly (besides setting many other things up better than adb does).

Put this into your ~/.bash_aliases (on the host computer, not the device)

alias sd='adb shell start ssh; \
    adb forward tcp:2222 tcp:22; \
    ssh-keygen -f ~/.ssh/known_hosts -R [localhost]:2222; \
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
        phablet@localhost -p 2222'

and close/reopen the terminal window.

Now you can just do a "sd" (short for ssh device) and you'll be logged in as user phablet on the phone, with a properly configured terminal and a properly set up user environment.

share|improve this answer
Scroll down for an expansion of this approach that offers a couple advantages. – Robru Apr 29 '14 at 22:23
This idea has been expanded and is now available in Ubuntu (at least in Utopic). Run apt-get install phablet-tools and it comes with a tool called phablet-shell which enables SSH on the device, copies your ssh key id down to the device, and then connects in with ssh for a nice smooth terminal experience. – Robru Jul 2 '14 at 16:09

It's not a bug in the terminal - the default setup of the shell on android is just not configured to handle changing window sizes.

After you resize the actual terminal window, use the resize command - then use your fullscreen program.

share|improve this answer
busybox resize on some builds of Android. – Rupert Rawnsley May 5 at 9:08

Building off of mzanetti's answer above, I've expanded it to have a couple advantages that I'm now using regularly:

function adbshell {
    adb shell start ssh
    adb forward tcp:2222 tcp:22
    ssh-keygen -f ~/.ssh/known_hosts -R [localhost]:2222
    ssh-copy-id -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
        phablet@localhost -p 2222 2>/dev/null
    scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
        -q -P 2222 -r ~/.bash* ~/.profile* phablet@localhost:/home/phablet
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
        phablet@localhost -p 2222
  • It remembers your credentials so you don't have to type your password every time

  • It copies your bash config from the host to the device so you can use all your favorite aliases (and custom prompt config!)

share|improve this answer

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.