I am not so into Linux and I have the following doubts: a client provided me an Ubuntu 18.04.3 LTS virtual machine which I access via SSH. (I am using MobaxTerm as SSH client but it should not be the problem.) The shell used is sh
.
The problem is that in the shell the autocomplete function is not working as I expected using the Tab key.
It simply put the classical tab white spaces.
Why? How can I change this configuration?
sh
is provided bydash
in Ubuntu. Many shells, includingbash
andzsh
, have sophisticated features for easy interactive use.dash
is deliberately quite minimal and does not offer such features. In particular, it does not offer tab completion.Even stripped-down Ubuntu systems typically have
bash
installed because it is considered an essential package--we're supposed to be able to assume it is present even outside the case where another package depends on it. Typicallybash
is the default user shell on Ubuntu--that is, the login shell new users get by default--though this can be reconfigured.I recommend you use
bash
or another shell that is nice to use interactively. You can see ifbash
is available in that VM by running:Assuming your
$PATH
is set reasonably, that will runbash
if it is available. You can make sure that tab completion works inbash
--it should, but there's no reason not to check--and then get tab completion in the future through one of two approaches:bash
when you want tab completion and otherbash
features.bash
with thechsh
command.Note that there is a separate package called
bash-completion
which is also usually installed. This provides programmable tab completion--that is, tab completion that varies by context and, for example, knows about the flags and other syntax of commands. It's possible to havebash
installed but notbash-completion
.(To find out if any particular package--
bash
,bash-completion
, or anything else--is installed you can useapt list package-name
. For more information about a package you can useapt show package-name
andapt policy package-name
.)