How can I get tab completion back? In terminal, if I try tab completion in a directory e.g. Movies, instead of the movies beginning with S (if I type S followed by tab, I see SetFile, Splitforks and SystemStarter. I suspect I installed something which has messed with my PATH variable. How can I get correct path completion back?

OSX 10.8.2 on Early 2011 Macbook Pro
In the Terminal, at the start of the command line, tab completion is looking for an executable file that is on the PATH (unless a specific directory is indicated). 

When you are looking in the Movies directory, and the current directory is likely not to be on the PATH so it will find the three files indicated. 

In order to find out where these files are, you can use the which command:

$ which SetFile
/usr/bin/SetFile


To find the contents of the current directory, you would type the ls command. That should list the files that are in the directory. For more information about all the files, type ls -l.

Once you have a command shown, tab completion will look for a file in the current directory to use as an argument.

If you are looking to do something with a movie, you'll need a command. You might want to type open. So, type open Stab, and it should do the tab completion magic for you. The open command will open a file as if you double clicked on it. You can find out more about the open command by typing man open.