ShellSpells
  • 🧙‍♂️Welcome!
    • ShellSpells
    • FAQs
    • License & Disclaimer
  • 🐧Linux
    • System Ops
      • Transcripts
      • Help
      • System Info
        • Date/Time
        • System Details
        • Patches & Updates
        • Init System Identification
        • Hostname / Host ID
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Shares
        • Packages
        • Connected Devices
        • Kernel Modules (Drivers)
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Jobs
        • Enumerate
        • Modify
      • Processes
        • Enumerate
        • Modify
        • Custom Script and Shared Object
        • Process I/O Redirection
      • Services
        • Enumerate
        • Modify
        • Create a Service
      • Startup/Boot Scripts
        • Enumerate
        • Modify
      • Security
        • Antivirus
        • Firewall
        • SSH Keys
      • History & Logs
        • History
        • Logs
    • File Ops
      • Search
        • Filename
        • Content
        • Users (Owners)
        • Time
        • Size
        • Permission
        • Hidden Files
        • Inode
        • Find + Exec
        • Notes
      • Enumerate Metadata
      • Modify Metadata
      • Read Content
      • Modify Content
      • Extract Content
      • Sort / Compare / Count
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
    • Terminal Ops
      • Keyboard Shortcuts
      • Tmux Shortcuts
  • 🪟Windows
    • System Ops
      • Transcripts
      • Help
      • System Info
        • One-liners
        • Date/Time
        • System Details
        • Hotfixes
        • Domain or Workgroup
        • Data Execution Prevention
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Installed Software
        • Drivers
        • Shares
      • Registry
        • Enumerate
        • Modify
        • Forensically Relevant Keys
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Tasks
      • Processes
        • Enumerate
        • Modify
      • Services
        • Enumerate
        • Modify
      • Autorun / Startup
        • Enumerate
        • Modify
      • Security
        • Permissions
          • Enumerate
          • Page
        • Antivirus
        • Firewall
          • Enumerate
          • Modify
        • Audit Policies
        • Remoting
          • Enumerate
          • Modify
          • Registry Locations
        • Stored Credentials
      • Remote Command Execution
      • Active Directory
        • Enumerate
        • Modify
      • History & Logs
        • History
        • Logs
      • PowerShell Config
      • Scripting
      • WMIC Notes
    • File Ops
      • Search
        • Filename
        • Time
        • Size
        • Permissions
        • Attributes
        • Wildcarding
      • Enumerate Metadata
        • One Liners
        • Users (Owners)
        • Timestamps
        • Size
        • Permissions
        • Attributes
      • Modify Metadata
        • Change Owner
        • Timestamps
        • Size
        • Attributes
      • Read Content
      • Modify Content
        • Overwrite
        • Insert
        • Append
        • Replace / Remove
        • Convert Case
        • Alternate Data Streams
      • Extract Content
      • Sort / Compare / Count
        • Sort
        • Count
        • Compare
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
      • Output Formatting / Filtering
      • File Formatting
      • Operators
  • ⛓️Network
    • Traffic Manipulation
      • iptables
        • Option List
        • General Commands
        • Filter Tables
        • NAT
        • Mangle
        • Filter for SSH Traffic (Example)
      • nftables
    • Packet Capture
      • Syntax
      • TCPDump Examples
    • Packet Analysis
      • Wireshark
  • 🚗Maneuver
    • SSH
    • Control Sockets
    • RDP
    • Windows Port Proxy
  • 🛩️Data Transfer
    • SCP
    • FTP
    • Netcat
      • Netcat Relays
    • Server Interactions
    • Alternate Methods
  • 🪄REGEX
    • Examples
Powered by GitBook
On this page
  • Enumerate
  • Commands
  • Find History Files
  • Find Creds in History Files
  • Modify
  • Unset History
  • Bash
  • Zsh

Was this helpful?

  1. Linux
  2. System Ops
  3. History & Logs

History

Enumerate

Commands

history

Earlier commands used by the user.

history | grep <search_term>

Searches for specific commands in the history.

history | less

Paginates through the command history.

history | tail

Displays the most recent commands in the history.

fc -l

Lists, edits, or re-executes commands from the history list.

cat ~/.bash_history

Displays the entire command history.

cat ~/.*history | less

View history

env

Run this first because you want to see A) If the HISTFILE is set B) What env variables are set.

printenv

Similar to env, shows environment variables. can be leveraged.

Find History Files

find / -name .bash_history

Searches for bash history files for all users.

find / -name .zsh_history

Locates Zsh history files across the filesystem.

find / -name .history

Finds generic shell history files, applicable to various shells.

ls -la ~/.*_history

Lists all history files in the current user's home directory, covering bash, zsh, etc.

echo $HISTFILE

Displays the path to the current shell's history file, works in shells like bash and zsh.

Find Creds in History Files

history | grep -i password

Searches command history for the term "password".

history | grep -i "api_key"

Looks for occurrences of "api_key" in command history.

history | grep -i "secret"

Filters command history for the term "secret".

history | grep -E "pass|key|secret"

Uses extended regex to search for multiple terms related to sensitive information.

Modify

Unset History

Removes the history of your current commands:

\unset HISTFILE HISTSIZE HISTFILESIZE

Bash

history -d <number>

Deletes specific entries from your history.

history -c

Clears your entire history.

history -a

Appends history to a file (e.g., history -a ~/my_history.log).

Zsh

history -g

Shows global history across sessions.

history -d oldest

Deletes the oldest entry.

history -f

Saves history to a file (e.g., history -f ~/zsh_history).

PreviousHistory & LogsNextLogs

Last updated 1 year ago

Was this helpful?

🐧