Useful Shortcuts and Commands

Learn a few of the useful shortcuts for the CLI.

We’ve already learned that typing cd returns us to our home directory. This is just one of the many shortcuts available on the command line.

Command-line shortcuts

First, if we press the “Up” arrow key on our keyboard, the previous command we issued will appear on the command line. Press “Enter” to execute it again. Or press “Up” again to see the command we typed before that. Keep pressing the “Up” arrow to move through the history of commands we’ve typed. Pressing the “Down” arrow key will move forward through our command history.

Second, we can see all the commands we’ve typed with the history command. Each one will be listed with a number:

$ history

Get hands-on with 1200+ tech skills courses.