How to Clear the Terminal Command History

How to Clear the Terminal Command History – Clearing typed commands from terminal history. By default, up to the last 500 command lines a user types in the terminal window are saved into a hidden .bash_history file. The previously typed commands can be readily accessed by using the up and down arrow keys. This makes it easy to retrieve and reuse your recently used commands. However, maybe you want to clear the terminal command history list and start fresh?

This simple tutorial explains the process of viewing and then optionally clearing the terminal history also known as bash command history.

Viewing Terminal Command Line History

To view the complete history of commands typed in the terminal “for the logged in user”, open the terminal and simply type history

Steps to Clear the Terminal Command History

Clearing bash history is relatively easy. Simply perform the following steps, repeating for each user.

  1. Login with the user account whose terminal history you plan to clear.
  2. Open a terminal window and type history -c
  3. Repeat the process if necessary for each user account.