I have a directory filled with PDF files, all with long descriptive names. So I rely heavily on tab completion when opening any one of them.

However, tab completion only works for zathura, and not for either evince or okular. It does work for evince-previewer, though.

How can I fix this up so that tab completion works for all viewers?

(FWIW: Bash shell in 12.04LTS.)

1 Answer 1


You can add to your ~/.bashrc file the following:

complete -f -X '!*.[pP][dD][fF]' evince okular foo

And now it will autocomplete with pdf files evince, okular and foo.

The other way (the correct and formal one), would be to find the autocompletion files and modify them to make them work, they use to live in:

  • /etc/bash_completion.d/
  • /usr/share/bash-completion/completions/

Have fun


You must log in to answer this question.

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