Skip to main content

Clear Bash History

Anti-forensics
technique
Updated 23 October 2025

A subject clears bash terminal command history to prevent executed commands from being reviewed, disclosing information about the subject’s activities.The Command Prompt on Windows only stores command history within the current session, once Command Prompt is closed, the history is lost.On Linux-based operating systems different terminal software may store command history in various locations, with the most common being /home/%username%/.bash_history. Using the command history -c will clear the history for the current session, preventing it from being written to .bash_history when the session ends.On MacOS the Terminal utility will write command history to /Users/%username%/.zsh_history or /Users/%username%/.bash_history based on the operating system version.

1
Prevention Strategies
2
Detection Methods
0
Tactics
2
Contributors

Prevention Strategies (1)

No Ready System-Level Mitigation

This section cannot be readily mitigated at a system level with preventive controls since it is based on the abuse of fundamental features of the system.

From the Matrix:

This section cannot be readily mitigated at a system level with preventive controls since it is based on the abuse of fundamental features of the system....

Detection Methods (2)

.bash_history Timestamp Discrepency

The .bash_history file, located within a user's directory on MacOS and Linux, is written with command history from shell sessions.If the file has a Created timestamp, but a user has used a shell utility previously, this may indicate the file was deleted and manually or automatically re-created.

Missing .bash_history File

The .bash_history file, located within a user's directory on MacOS and Linux, is written with command history from shell sessions.If the file is missing, this could indicate that it has been deleted, if a user account has used a shell utility previously.

Contributors

Forscie® Limited
The ITM Team

Our pillar mapping

Our own keyword match of each prevention and detection to the Insider Risk Index's five pillars. It is not part of the Forscie Matrix and not a measured value.

Visibility
Prevention & Coaching
Investigation & Evidence
Identity & SaaS
Phishing Resilience

Attribution

This technique is part of the Forscie® Insider Threat Matrix™. Copyright 2026 Forscie® Limited. Licensed under Apache License 2.0.

View on Forscie® Insider Threat Matrix™
Clear Bash History | Insider Risk Index