Question

I need to navigate to a certain directory and then execute a script located there.

I am using cd folder_name to navigate to the next directory.

One folder has a very long name (with white spaces). Is there a way to type only the first few letters and then use a shortcut key to autocomplete with the first matching name, or to navigate through possible matches?

The same if I want to perform a command on a certain file (e.g. chmod XXX file_name), is there a way to get the name to appear after I type a few letters of the filename?

The shell I am using is bash-3.2 in OS X 10.7.4.

Was it helpful?

Solution

Yes, Bash supports auto-completion (personally, it's one of my favorite features). Use the Tab key to complete what you've typed (note that it's case-sensitive). The Advanced Bash-Scripting Guide has a section on an introduction to programmable completion. You can enable completion to complete command names and more!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top