CyberKit

Shell History Files

Also called .bash_history, .zsh_history, command history.

Per-user logs of typed shell commands; a key record of operator activity on Unix.

What it is

Plain-text files in a user's home directory (~/.bash_history, ~/.zsh_history, ~/.local/share/fish/fish_history and similar) where interactive shells record the commands a user ran. Zsh and fish can also store timestamps; bash does so only when HISTTIMEFORMAT or extended history is enabled.

Where it lives

~/.bash_history, ~/.zsh_history, and (fish) ~/.local/share/fish/fish_history

Why it matters

On Linux and macOS this is often the closest thing to a keystroke log of hands-on-keyboard activity, exposing downloaded tooling, lateral movement, and cleanup. Investigators also watch for tampering: a truncated file, HISTFILE pointed at /dev/null, or unset HISTFILE all signal anti-forensics.

In practice

A trimmed .bash_history paired with a HISTSIZE=0 line in .bashrc showed the intruder disabling history right after their first wget of a rootkit.

What to look for

  • Commands such as wget, curl, chmod +x or base64 decoding.
  • History files that are empty, linked to /dev/null or cut short.
  • HISTFILE or HISTSIZE changed in the session.

Common mistake

Treating it as complete. History is written at logout and is easy to disable, so missing lines prove little.

Use it in CyberKit

In the field

Well-known tools where this shows up on the job. They are listed to show the landscape, not as a recommendation.

  • osquery Open source

    Exposes Linux and macOS system state as SQL tables you can query.

  • Velociraptor Open source

    Collects Linux artifacts such as logs, cron and shell history at scale. Our notes.

  • Falco Open source

    Watches system calls at runtime and alerts on suspicious behavior.

  • Wazuh Open source

    Collects Linux logs and checks file integrity on each host.

Read next

Sources