Today I learnt something very small yet useful when using the command line.

Using * when trying to specify a file or directory when executing a command (such as changing directory) will try and find the closest match. So for example, say I wanted to change directory to the example directory. However, I can't remember the name of the directory for the life of me and I need to be quick.

Running cd exa* will try and enter the closest match to this.

This small feature, as well as other commands I already know, come in handy when exploring projects I am working on. Below are a list of a few commands you might also find useful.

  • Executing - (hyphen/dash) will take you to the previous directory you were in.
  • Using Zsh/Presto? You dont need to add cd to the front of your change directory commands. This should autocomplete.
  • Same applied to going up a directory. You will only need to type .. and up you go.

Hope this helps someone out there.