Skip to content

Linux history Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux history Guide

Complete beginner-friendly guide to history on Linux, covering Arch Linux, CachyOS, and other distributions including command history, history navigation, and history management.


Table of Contents

  1. Understanding history
  2. history Basics
  3. History Navigation
  4. History Management
  5. Troubleshooting

Understanding history

What is history?

history shows command history.

Uses:

  • View history: See past commands
  • Reuse commands: Run previous commands
  • Search history: Find past commands
  • History management: Manage command history

Why it matters:

  • Productivity: Reuse commands quickly
  • Learning: See what you did
  • Efficiency: Save typing

history Basics

View History

Basic usage:

# Show history
history

# Shows numbered list

Last Commands

Recent history:

# Last 10 commands
history 10

# Or
history | tail -10

History Navigation

Search History

Find commands:

# Search history
history | grep command

# Or use Ctrl+R
# Press Ctrl+R, type search term

Run by Number

Execute by number:

# Run command by number
!42

# Executes command #42

History Management

Clear History

Delete history:

# Clear current session
history -c

# Or clear file
> ~/.bash_history

History Size

Configure size:

# In ~/.bashrc
HISTSIZE=10000
HISTFILESIZE=20000

Troubleshooting

History Not Saving

Check config:

# Verify history file
ls -la ~/.bash_history

# Check HISTSIZE
echo $HISTSIZE

Summary

This guide covered history usage, command history, and history management for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally