Bash history
Shell history files such as ~/.bash_history and ~/.zsh_history record commands typed into interactive shells, per user.
What Command History is
Execution artifacts record that a program was present or ran: what, where from, how often and when. They are the core of "what did the attacker run?"
Forensic value
What Command History can tell an investigator:
- The commands an attacker typed, in order, often including tool downloads, credential access and clean-up.
- Anti-forensics traces: unset HISTFILE, history -c or a history file linked to /dev/null.
- A cleared history is itself a finding. When .bash_history is empty, zero bytes, recently truncated or a link to /dev/null on an account that clearly logged on, someone chose to hide what was typed; auditd execve records, sudo logs and file-system times usually still show the commands or the moment of clearing.
What it does not prove
- Bash records no timestamps unless HISTTIMEFORMAT is set; zsh extended history does.
- History is written when the shell exits, so killed sessions may never be saved.
- Files are easy to edit or delete; corroborate with auditd and file-system times.
Where it is stored
Arcsentry looks for Command History at these locations inside a collection, disk image or mounted volume:
**/home/*/.ash_history
**/home/*/.bash_history
**/home/*/.config/fish/fish_history
**/home/*/.cosh_history
**/home/*/.dash_history
**/home/*/.esh_history
**/home/*/.irb_history
**/home/*/.local/share/fish/fish_history What Arcsentry records
Each Command History record is written to Arcsentry's common schema with these fields, alongside the host, timestamp and provenance every record carries:
| Field | Type | Meaning |
|---|---|---|
log_file | VARCHAR | Source log file path |
log_line_number | BIGINT | Line number within the source log file |
process_command_line | VARCHAR | Process command line |
process_interpreter | VARCHAR | Interpreter or shell that produced a command-history entry, as invoked |
source_file_modified | TIMESTAMP | Modification time of the source artifact file, carried only on records that lack a parsed event timestamp (substituted-time provenance, never a forensic event time) |
message | VARCHAR | Human-readable message |
artifact_read_status | VARCHAR | Source read failure: unreadable (the source could not be read), corrupt (its bytes failed format or stream integrity checks), unrecognized (the content does not identify a supported format), or unsupported (the format version or a required format extension is not supported); records read before a failure may still be present |
Time
Arcsentry keeps each record's own time and labels its time zone when the source does not state one. A record with no time of its own stays untimed; Arcsentry never substitutes the collection time.
Collecting Command History with Arcsentry Collector
Arcsentry Collector gathers Command History in these triage profiles: linux::profile::triage::offline, linux::profile::triage::full. It is read straight from the file system, on a live host or inside a disk image, without mounting.
The collection targets that pick it up: linux::execution::docker_ondisk, linux::filesystem::bodyfile.
sudo ./arcsentry-collect collect --local -t linux::profile::triage::offline \
-o /mnt/ir -f host.arcx --password-file /mnt/ir/pw.txt Every file lands in one AES-256 archive with a SHA-256 recorded for it, and the collection log notes which target collected it. See everything each profile collects.
Already collected with something else? Arcsentry also reads KAPE, Velociraptor and UAC collections, so Command History can come from the tools you already use.
Analysing Command History in Arcsentry
Ask in plain English, for example "show Command History records from the incident window, newest first", and Arcsentry shows the query before it runs. Or write it in AQL:
filter event_type == "bash_history"
sort {-timestamp}
take 100 Mark a record malicious or suspicious and it joins the timeline in its kill-chain lane. Add its values as indicators and Arcsentry matches them across every host. When the AI investigator works the case, it reads Command History records with the same tools and cites them by event ID.
Corroborate with
No single artifact settles a question on its own. Check Command History against:
- auditd: Parses /var/log/audit/audit.log* and correlates the SYSCALL, EXECVE, CWD, PATH and USER_* records of one audit event by its stamp (time and serial).
- sudo log: Parses sudo command execution log entries.
- Syslog: Parses Linux syslog and auth.log files.
Frequently asked
How can you tell if bash history was cleared?
Look for a zero-byte or very short ~/.bash_history on an account with recent logons, a modification time that matches a logon session, a symbolic link to /dev/null, or HISTFILE, HISTSIZE or history -c in the shell start-up files. auditd (execve), sudo logs and the systemd journal can still show what was run.
Where is zsh history stored?
In ~/.zsh_history by default, or the file named by HISTFILE. With the EXTENDED_HISTORY option zsh writes a start time and duration for each command, which bash does not do by default.
Does .bash_history have timestamps?
Not by default. If HISTTIMEFORMAT was set, bash writes a timestamp line before each command. Otherwise, place lines using auditd, sudo and file-system evidence.
Does Arcsentry parse Command History?
Yes. Arcsentry's Command History parser (bash_history) reads it from Linux evidence and records 7 fields per record, with provenance back to the source file.
How do I collect Command History?
Arcsentry Collector gathers it with the offline triage profile (linux::profile::triage::offline), live or from a disk image, sealed in an AES-256 archive with a SHA-256 for every file.
Parse Command History on your own evidence.
Tell us what you want to investigate. A person replies within one business day with the download and a trial licence.
Request a trial