Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Teachable.

Complete the name of a directory or file – Terminal

Summary

To complete the name of a directory or file in your terminal, type one or more characters, then press Tab.

Details

You can use the above shortcut in conjunction with your other commands in the terminal, such as cd or ls, to speed up your workflow.

If the autocomplete feature doesn’t work when you press Tab, try pressing it again to display a list of possible matches on the next line.

Alternatively, you can try typing a few more characters and try pressing Tab again.

If there is no match, try using the ls command to verify that the directory or file exists in the current directory.

Exercises

Try using the Tab shortcut with the ls command.

References

Terminal User Guide on Apple Support (see the Edit a command line section)

Command Line Primer on the Apple Developer Archive (see the Frequently Used Commands section)

Back to: Terminal Reference > Terminal Tips