Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added my script to /usr/bin, and it runs as expected if I type the full command name. How do I get the terminal to autocomplete the command name?

share|improve this question

migrated from May 11 '13 at 23:52

This question came from our site for professional and enthusiast programmers.

how do you run your script? did you set the execution permission? – BЈовић May 11 '13 at 14:05
Yes, execution permission is provided. – Abhishek May 11 '13 at 14:48
hash -r

or open a new shell.

When your shell starts up, it scans your PATH and caches the names and locations of programs it finds; when you ask it to run a program, it then checks its cache first and if it finds the location there it doesn't have to scan all the directories in your path, which is fairly time consuming. Bash uses the results of the initial scan for command tab-completion (and doesn't update it when you run a new program), so your program won't make it into there until you open a new session or tell it to rehash the path.

N.b. for future answer-seekers: in zsh, use rehash

share|improve this answer
It’s rehash in csh, too. – Scott May 12 '13 at 0:32

You must log in to answer this question.