I am using tcsh. I found that when I do scp mytab, it doesn't autocomplete to my-file.txt under the current directory I have to prefix a ./ there to make it complete. This seems to only happen with scp. I tried other commands, it seems to work fine.

I find that scp tab gives me the value of of $HOSTNAME (i.e. the current hostname) localhost

So it looks like it's trying to match the hostname, don't know why..

added in response to comment:

 ~/temp/test>ls -al
total 12
drwxr-xr-x 2 liw liw 4096 Jul 21 15:16 .
drwxr-xr-x 9 liw liw 8192 Jul 21 15:15 ..
-rw-r--r-- 1 liw liw    0 Jul 21 15:16 my_file.txt

~>more .cshrc.user 
set prompt="%n@%m %~%#"

set path=($HOME/bin $path)

if (-o $HOME/.aliases) source $HOME/.aliases

set filec
set autolist
set autoexpand
set addsuffix

bindkey ^r i-search-back

~> complete scp
'c%*@*:%`set q=$:-0;set q="$q:s/@/ /";set q="$q:s/:/ /";set q=($q " ");ssh $q[2] -l $q[1] ls -dp $q[3]\*`%' 'c%*:%`set q=$:-0;set q="$q:s/:/ /";set q=($q " ");ssh $q[1] ls -dp $q[2]\*`%' 'c%*@%$hosts%:' 'C@[./$~]*@f@' 'n/*/$hosts/:'
  • An ls of the directory in question might be helpful. I suspect that you have >1 files starting with my preventing the autocomplete from adding anything further.
    – mdpc
    Commented Jul 21, 2013 at 21:59
  • Post your ~/.tcshrc or ~/.cshrc Commented Jul 21, 2013 at 22:10
  • 1
    @mdpc But then ./my[TAB] wouldn't work any better.
    – Joseph R.
    Commented Jul 21, 2013 at 23:11

2 Answers 2


There is almost certainly a systemwide tcsh configuration file in /etc that has a special complete command defined for scp. The easiest way to check this is to type


which will list all the custom completions. The custom completion directives are kinda complicated, but the intention is probably that if you are using scp at least one of the arguments wants to have a hostname in the filepath. You can then try to figure out that arcana or just add

uncomplete scp

to your ~/.tcshrc and fly on manual-override for that one command.

  • You are right! I updated my question with "complete scp"
    – wei
    Commented Jul 22, 2013 at 4:04
  • Thanks for the update. I think I have now seen code that is marginally harder to make sense of than Perl.
    – msw
    Commented Jul 23, 2013 at 11:42

Auto complete will try to match all entries in your hosts file. I once did an auto complete and got "sexyladies.com" and thought my system was compromised as I never visited that site.

It wasn't, I had a hosts file setup with about 20k entries of sites I wanted to block. So every time I do an auto complete it goes through that list.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .