Join our Newsletter — 33% off our NHI Course
Home› Glossary› Threats, Abuse & Incident Response› Command History Deletion
Threats, Abuse & Incident Response

Command History Deletion

← Back to Glossary
By NHI Mgmt Group Updated November 2, 2026 Domain: Threats, Abuse & Incident Response

Command history deletion is the removal of recorded shell or terminal commands so they are no longer available for review. It is used in system shells and administrative consoles to conceal prior activity, which can reduce the visibility of privileged actions during forensic investigation and audit review.

What command history deletion is

Command history deletion is a form of anti-forensics. It does not remove the underlying administrative action, but it can remove one of the most familiar review surfaces that defenders use to reconstruct what happened at a shell or terminal.

Because shell history is often consulted during incident response, command history deletion matters less as a standalone action and more as a signal that an operator may be trying to hide interactive activity, especially after privilege use or lateral movement.

How command history is recorded and why deletion works

Most interactive shells keep a local record of commands for convenience, troubleshooting, and audit support. Depending on the shell and configuration, that record may live in a user profile file, session memory, or a console-specific log. Deletion works when the attacker clears or truncates that record, disables history capture, or exits in a way that avoids flushing the session history to disk.

The weakness is structural: shell history is valuable, but it is not a complete audit trail. If defenders rely on it as the primary record of administrative activity, a user who can modify their own history may be able to erase context that would otherwise explain what was done and why.

Where it fits in attacker cleanup

Command history deletion is commonly used after a successful compromise to reduce forensic visibility. It often appears alongside other cleanup behavior such as file deletion, log clearing, timestomping, or removal of command traces from remote shells and administrative consoles. In MITRE ATT&CK terms, it aligns with the broader pattern of indicator removal, and defenders should treat it as part of post-action concealment rather than an isolated housekeeping step. T1070 Indicator Removal Defensive Guide

For defenders, the important point is that deleting history usually does not prove the absence of activity. It may only mean the most convenient record has been altered. That makes correlated telemetry, such as process execution records, audit logs, EDR events, and remote log collection, far more important than a terminal history file alone.

What defenders should look for

Exposure is highest when users can run privileged shells on systems where command history is locally stored and lightly monitored. In those environments, a small number of commands can establish persistence, disable defenses, stage tools, or perform discovery, then be hidden from casual review by erasing history afterward.

MITRE ATT&CK Guide for Defenders is useful here because it frames command history deletion as a detection problem: the goal is to map suspicious cleanup behavior to the broader attack path, not to assume the visible shell log is complete. NIST Cybersecurity Framework 2.0 is also relevant where organisations need a broader detect-and-respond discipline for administrative activity and evidence preservation.

Good review questions include whether shell history suddenly stops appearing, whether a privileged session ends without the expected command trail, whether the same account shows execution evidence in other logs but not in history, and whether cleanup occurred after high-risk actions such as credential access or system modification.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK addresses the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
MITRE ATT&CKT1070 — Indicator RemovalCommand history deletion is a form of attacker cleanup under indicator removal.
Recommendation — Correlate shell-history gaps with adjacent execution and audit telemetry to detect cleanup activity.
NIST CSF 2.0DE.CM-01 — The organization monitors networks and environments for potential cybersecurity eventsHistory deletion is detectable through monitoring of administrative and endpoint activity.
DE.AE-01 — A baseline of network operations and expected data flows is established and managedUnexpected loss of command-history evidence becomes meaningful when normal administrative traces are baselined.
Recommendation — Monitor privileged sessions and endpoint events for signs that command history was cleared. Baseline expected administrative telemetry so missing shell history stands out as anomalous.
NIST SP 800-53 Rev 5AU-9 — Protection of Audit InformationHistory deletion highlights the need to protect logs and evidence from tampering or loss.
Recommendation — Store audit evidence in protected, centralized repositories that a local user cannot erase.
CIS Controls v8CIS-8 — Audit Log ManagementCommand history deletion is a logging integrity problem that audit log management must address.
Recommendation — Centralize and retain administrative logs so local shell history cannot become the only record.

Practitioner Guidance

What to watch for: Treat missing or partial shell history as a signal, not a conclusion. If the command trail disappears around a privileged session, investigate surrounding telemetry before assuming benign user behaviour. History loss is most useful to an attacker when it is accepted as normal.

Governance implication: Do not assign forensic confidence to shell history alone. Organisations should treat terminal history as one evidence source among several and ensure that administrative activity can still be reconstructed from independent logs when local history is cleared or unavailable.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org