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.

Viewing the complete terminal command history:

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

How to clear the terminal command line history:

  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

Similar Portable Linux Posts:

  • No Similar Portable Linux Posts Detected
Disclaimer