As all of you know, Mac OS X stores all commands that run from Terminal in Terminal itself, however, I want to delete (for example) the last 3 commands from the terminal. How can I do this?
Mac OS does not store anything anywhere.
The terminal command history is stored in a hidden file in your user directory called
This means the file is:
You have to enable "Show System Files" to see it (from the "View" menu in finder).
The file is just a textual list of everything you type in the shell. You can open it in TextEdit, or your editor of choice.
You should probably close
It's not a Mac OS feature but a shell feature. Assuming that you are using bash (the default):
For Mac Terminal user
delete bash commands history with the following command
For Mac zsh user
delete zsh commands history with the following command