View Linux History Range 100 to 200 | Generated by AI

Home 2026.02

Question: In Linux history command, how to show commands from the 100th most recent to the 200th most recent (not just the last 100)?

Answer:

The history command numbers entries from oldest (small number) to newest (large number).
To see commands from the 100th most recent to the 200th most recent, you need to use negative offsets or calculate the absolute line numbers.

Here are the most practical ways:

history | tail -n 200 | head -n 100

This shows:

2. More explicit version (very clear what you’re doing)

# Show from 100th last → 200th last
history | tail -n +101 | head -n 100

3. Using negative range (bash 4+)

# Show history entries from -200 to -100 (inclusive)
for i in {100..200}; do history -$i; done

or shorter (but less readable):

history | sed -n '101,200p'

Quick summary – most common useful patterns

What you want Command
Last 100 commands history 100
or history | tail -100
Commands 100–200 ago (your question) history | tail -n 200 | head -n 100
Commands 101–200 ago history | tail -n +101 | head -n 100
Commands 50–150 ago history | tail -n 150 | head -n 100
Last 300 → skip newest 100 history | tail -n 300 | head -n 200

The most readable and commonly used version for your exact case is:

history | tail -n 200 | head -n 100

References:


Back Donate