Introduction

This section covers the shell history, how to repeat commands. Or portions of commands with Exclamation Mark Syntax, and how to use Autocompletion.

Shell History

Each command you enter into the shell is recorded in your shell history, having access to your shell history is extremely useful. You can search through your shell history, repeat commands that you've previously entered. And even recall previous commands, and change them slightly before executing them again. Not only can this save your time in keystrokes, but it can prevent you from making mistakes by running a previously known, good command.

Some shells like bash keep their history in memory, and only write the history to a file on exit. Common history files include .bash_history, .history and .histfile. These history files are stored in your home directory.

  • ~/.bash_history
  • ~/.history
  • ~/.histfile

The details of history and ! commands are covered in shell history and tab completion.

Searching Shell History

You can search for commands in your history, to start a reverse shell history search, type Ctrl + r. The details of search shell history is covered in search shell history.

References & Resources

  • N/A