Close ad

The Terminal app on macOS keeps a record of the most recently used commands so you can reuse them later. However, if you would rather erase them, in today's article you will find instructions on how to delete the history of Terminal commands.

When you type commands in the macOS Terminal app and press Enter, it remembers the commands you typed and saves them in case you want to use the same commands again later. In Terminal, you can scroll through all recent commands by pressing the up and down arrow keys on your Mac keyboard. When you do this, Terminal replaces the commands that are on the command line with individual commands from the saved command history as soon as you press the arrow keys.

You can scroll forward or backward through the command history in the Terminal, and press Enter on any saved command to rerun it. You may want to delete the Terminal command history for security reasons, for example. How to do it?

  • On your Mac, open Terminal.
  • To view the command history, type an expression in the command line history and press Enter.
  • On a Mac with macOS Catalina and earlier, you can immediately clear your command history by typing a command History - c.
  • On newer Macs, command history will be cleared immediately and without warning after a command is entered history - p and pressing the Enter key.

This way, you can quickly and easily clear your command history in Terminal Utility on your Mac. This step cannot be undone, and after pressing Enter, Terminal will no longer ask you to confirm whether you really want to delete the history.

.