Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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...

share|improve this answer
    
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. –  atx May 4 '12 at 3:35
    
complete -r commandname is probably the best bet. –  ewwhite May 4 '12 at 3:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.