+4 votes
in Operating Systems by (40.5k points)

On one of my VPS terminal, when I partially type a command and then press the "Tab" button, it does not show either suggestion or complete the command.

E.g.

If I type "systemctl restart php7.3" and then press the "Tab" button, I expect the complete command "systemctl restart php7.3-fpm.service" on the terminal. But no suggestion and no tab completion happens. What should I do to fix the issue?

1 Answer

+1 vote
by (346k points)
selected by
 
Best answer

When you press the "Tab" button after typing a command partially, the "bash_completion" application completes the command for you. You need to check a couple of things to fix the issue.

  • Check if the file "/etc/bash_completion" exists. If not, install it by typing the following command on the terminal:
sudo apt-get install bash-completion
  • Open the file "/etc/bash.bashrc" and uncomment the following lines:
#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
  • Run the following command on the terminal to execute bash:

exec bash

Related questions

+4 votes
1 answer
+2 votes
1 answer

...