Networked applications like rsync and scp can tab complete when they are enabled with bash. But what if you want local tab completion without remote tab completion? Is it possible?
1 Answer
Assuming this is a Red Hat/CentOS-style system, you can remove the bash-completion for a specific application by navigating to /etc/bash_completion.d/
and removing the entry (symbolic link) that corresponds to the command...
[root@xt /etc/bash_completion.d]# ls -l
total 132
lrwxrwxrwx 1 root root 38 Oct 4 2011 _subversion -> /usr/share/bash-completion/_subversion
lrwxrwxrwx 1 root root 31 Oct 4 2011 _yum -> /usr/share/bash-completion/_yum
.
.
.
lrwxrwxrwx 1 root root 32 Oct 4 2011 rsync -> /usr/share/bash-completion/rsync
lrwxrwxrwx 1 root root 32 Oct 4 2011 samba -> /usr/share/bash-completion/samba
lrwxrwxrwx 1 root root 33 Oct 4 2011 screen -> /usr/share/bash-completion/screen
lrwxrwxrwx 1 root root 34 Oct 4 2011 sqlite3 -> /usr/share/bash-completion/sqlite3
lrwxrwxrwx 1 root root 30 Oct 4 2011 ssh -> /usr/share/bash-completion/ssh
lrwxrwxrwx 1 root root 33 Oct 4 2011 strace -> /usr/share/bash-completion/strace
Also, it seems that complete -r commandname
can also work.
Edit:
You can also edit the bash completion entries for a particular service. For instance, in scp
, you can comment out the references to the _scp_remote_files
function to give local folder completion without expanding remote filesystems...
-
This seems like a semi-decent solution, but could get tedious with many different applications installed. Newly installed applications would have to be taken into account too. Isn't there a better way? Considering that all the applications define their own completion I suppose it's impossible.– atxMay 4, 2012 at 3:35
-