Sometimes with a new user on Ubuntu I find that filename auto-completion is missing in the shell. I found two issues that cause this:
1. Ubuntu sets new users to /bin/sh which is a very limited shell. So first step is to change the user to /bin/bash:
1 |
chsh -s /bin/bash rpenguin |
2. The /etc/bash.bashrc has filename completion disabled by default. Edit this file and un-comment the appropriate lines. Here’s what it looked like on one server:
1 2 3 4 5 6 7 8 |
# enable bash completion in interactive shells #if ! shopt -oq posix; then # if [ -f /usr/share/bash-completion/bash_completion ]; then # . /usr/share/bash-completion/bash_completion # elif [ -f /etc/bash_completion ]; then # . /etc/bash_completion # fi #fi |
So I changed to:
1 2 3 4 5 6 7 8 |
# enable bash completion in interactive shells if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi |
Upon login the new user should now have filename completion features.
Also note that by default “vi” is handicapped. Here’s how to upgrade to a full feature set: