• Uncategorized

About linux : Bash-alias-autocomplete-with-tab-key-inserts-a-\-character-while-auto-completing

Question Detail

OS: Debian 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux
Hardware: 1 Core, 2GB RAM, VPS ( Cloud server)

Example:

alias defined
@syslog='sudo less +F /var/log/syslog'

If I manually type in the complete alias i.e. @syslog – then it executes fine.

However, if I only type a few characters like @sys or @sysl or @syslo and then press key to auto complete, the command is autocompleted and looks like @syslog

This command does not execute as it now has the ” character embedded automatically.

The same issue also happens with another alias like

!syslog='sudo less +F /var/log/syslog'    //This is auto completed as \!syslog

However, if I do not use any special character in my alias
For example

mylog='sudo less +F /var/log/syslog'

Then auto complete works absolutely fine


This behaviour is only seen on this particular VPS.
I have another VPS (hosted on a different provider) with the same setup and OS, and at least a dozen of my aliases defined as @xxxxx work fine.

Any ideas?

Question Answer

The above issue was happening as the bash-completion package was not installed in the debian instance.

The above problem is now resolved by

sudo apt install bash-completion

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.