• ID: DT054
  • Created: 09th June 2024
  • Updated: 09th June 2024
  • Platforms: LinuxMacOS
  • Contributor: The ITM Team

.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.

Sections

ID Name Description
AF001Hiding or Destroying Command History

A subject deliberately clears, modifies, hides, or suppresses command history records to conceal commands executed during activities associated with an infringement. This may involve deleting existing command history files, clearing session histories, modifying shell configurations, or preventing command history from being recorded.

 

Command history may contain evidence of file access, software execution, system configuration changes, data collection, or other activities relevant to an investigation. The subject may interfere with history mechanisms associated with command-line environments such as Bash, PowerShell, Zsh, or Python to prevent investigators from reconstructing the commands executed.

 

These actions may hinder forensic examination by removing or reducing locally available command execution records. However, command activity may remain recoverable through independent system logs, endpoint telemetry, or other forensic artifacts.

AF001.002Clear Bash History

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.