Why will bash not complete the bar.dat on the unzip line - the file is in the current directory. Is bash reading file extensions and trying to be helpful?

[a@localhost:~/tmp]$ echo "Hello World" > foo.txt
[a@localhost:~/tmp]$ zip bar.dat foo.txt
  adding: foo.txt (stored 0%)
[a@localhost:~/tmp]$ unzip bar.dat   <---- won't complete bar.dat
Archive:  bar.dat
replace foo.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: n
[a@localhost:~/tmp]$ file bar.dat
bar.dat: Zip archive data, at least v1.0 to extract

1 Answer 1


This is done by bash completion _install_xspec function. Your local setup may vary but typically various file extensions completions are controlled by _xspecs array. Do this:

$ set | grep _xspecs

You'll see a gigantic wall of text that starts with _xspecs=(. There will also be a section for unzip:


As you see there is no dat on this list.

  • Thanks, I got why it was doing it, I just wanted to stop it. Now I have a place to look. Oct 12, 2017 at 19:52

You must log in to answer this question.

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