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

  • 1
    First check your path, in the shell, do: echo $PATH
    – Gerry
    Mar 8 '13 at 12:10
  • Also check where you are pwd
    – mmmmmm
    Mar 8 '13 at 13:41
  • I've just tested this and get the same result. I think maybe you are not seeing a fault, but normal behaviour. Have you had this working before?
    – macaco
    Mar 8 '13 at 13:50

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

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.

  • Thanks - this was it. I started editing in the middle of a long ffmpeg command and completion wasn't working for me - I then confused myself by trying to tab complete in the same directory without a preceding command. D'oh!
    – codecowboy
    Mar 9 '13 at 6:51
  • My answer might've dumbed it down a little. You obviously know something if you're getting into the terminal but it was hard to know how much detail to go into for the answer based on your question. Mar 9 '13 at 7:40
  • No worries. I'm a developer but was having a 'senior moment' at the ripe old age of 37 :-/
    – codecowboy
    Mar 9 '13 at 8:04

You must log in to answer this question.

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