history
Clear history list
Delete all entries from the current shell’s history list (memory only):
Delete specific history entries
Delete a range of entries
- Example:
Deletes entries 100 through 120 (inclusive).
Write and read history files
Append current session to history file
Writes only new commands from this session to ~/.bash_history:
Write current history list to file
Overwrites the history file with the current in-memory list:
History expansion without saving
Displays the expanded command only.
Manually add commands to history
Append arguments as one single history entry
Example:
- Useful for logging commands you ran elsewhere.
Common operational patterns
List of commands you use most often
Notes
history -cclears memory only until followed byhistory -whistory -ais append-safehistory -woverwrites the history file- Range deletion is permanent once written