How do I tab autocomplete for files with spaces in it?

  • 1
    Please elaborate your use case. Do you want autocompletion for file names with spaces in them? What shell are you using? Bash manages this by default on all the distros I've used.
    – Joseph R.
    Jul 11, 2013 at 0:39
  • 1
    What shell are you using? Post the output of echo $0. Are you looking to do something like ls file na<tab> where the file name is file name? If so, your shell will look for a file starting with the letters na. You'd need to escape the space: ls file\ na<tab>.
    – user26112
    Jul 11, 2013 at 0:41
  • 2
    You... push Tab. Jul 11, 2013 at 0:42
  • It should work with bash by default. If it's not working on your platform, we may need more info.
    – rahmu
    Jul 18, 2013 at 7:21
  • I don't know why this got downvoted. The accepted answer is not obvious to an inexperience command-line user.
    – Glide
    Jul 23, 2013 at 7:28

1 Answer 1


Yes if you escape the space first,

e.g ls file\ abc<tab>

Otherwise the second abc here would be considered as another parameter, completion won't work then.

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