I don't know how to get the TAB key to autocomplete filenames, commands, or anything at all.

I'm on a Unix-like system (OS/390) and depend on several scripts that work in sh (Bourne shell, not BASH), but not in other shells (tcsh, for example), so I can't switch shells. I usually connect to this system via ssh or telnet from Ubuntu's GNOME Terminal running bash locally. Other people connect to the OS/390 system via telnet from the Windows XP command prompt, and they are able to autocomplete with the TAB key after issuing "set -o emacs". When I issue "set -o emacs", I get some of the appropriate functionality (ctrl-p to step backward through the history, for example), but not autocomplete.

I am aware of the "set -o vi" option, but using "ESC-*", etc does not appeal to me because I know that the simple TAB key works for other people.

Is there something about Ubuntu, the GNOME Terminal, bash, or ssh that sends a different tab character than a Windows XP command prompt running telnet?

Does anyone have an idea as to why I might not be able to get tab to autocomplete while people on that same remote machine, running the same shell, can?

What should be done in order to enable tab auto-complete?

2 Answers 2


(No answer to your exact question, but many workarounds.)

You don't need to match your scripting shell with your interactive shell. (For example, most (t)csh or zsh users write sh scripts). If you have or can install a better interactive shell than the Bourne shell (zsh, bash, tcsh), go for it. Even if you can't, look if there's a ksh, which is likely to have slightly better interactive features than a Bourne shell.

You can check what character the tab key sends by entering echo ' Ctrl+V Tab ' | od -t x1 Enter. 0000000 09 0a (i.e. at position 0, two characters, a tab and a newline) is the expected output. I don't expect this to be the issue.

If you can't get a comfortable environment, you could try doing more things remotely, using your local machine for interaction as much as possible. This has its ups and downs.

  • From Linux (or most other unices including OSX, but not from Windows), you can use sshfs to access the remote filesystem.
  • Within Emacs, you can easily browse remote files via Tramp (open /os390hostname:/path/on/remote/machine, you get completion). You can also use Eshell to get a remote shell interface (an Emacs built-in shell); if you change to a remote directory (cd /os390hostname:/path/on/remote/machine), the external commands you launch will be executed on the remote machine. If you need to run commands as root, Tramp (and Eshell which is based on it) can combine ssh with su or sudo.
  • thx! ctrl+v TAB appears to just expand into a tab, as in: >echo ' '|od -t x1 0000000000 05 15 0000000002 Commented Dec 15, 2010 at 20:01
  • It stripped the whitespace on me! There should be a tab-sized gap between the '' and a newline before 0000000000 and 0000000002. Anyway, I'll try your remote suggestions. Thx! Commented Dec 15, 2010 at 20:03
  • I'd upvote this, but I don't have enough reputation in this community. Commented Dec 15, 2010 at 20:03
  • @ThomasGHenry: Now you do! :-)
    – oKtosiTe
    Commented Dec 15, 2010 at 23:12
  • Yup! And I've exercised my privilege. :) Commented Dec 16, 2010 at 15:55

When you are able to issue set -o emacs and do not get an error message, you are most likely not using the bourne shell but a ksh derivate.

The Korn shell does auto-completion with ESC, did you try that?

BTW: if you really like to use a Bourne Shell with a history editor and with filename completion, you could try my portable Bourne Shell in:


As this is a Bourne Shell that was converted from sbrk() to malloc(), it runs on non-UNIX environments.

There still may be some problems with porting:

  • If your OS/390 environment uses EBCDIC, the ctype* files need some work.

  • If your environment does neither support fork() nor a OpenVMS-like vfork() emulation, there may be no way to make it compile and run without some days of effort.

See http://schillix.sourceforge.net/man/man1/bosh.1.html for a quick check of the features.

You must log in to answer this question.

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