Guide context: Published 13 October 2026. The situation below is an illustrative troubleshooting scenario, not a report of an AdminHint client incident. Banner artwork is illustrative.
You close a terminal after working through a problem. The next morning, the command you need is gone. Before increasing the history limit, find out whether Bash saved anything at all. A larger limit will not help if history is disabled, its file is unwritable, or you are looking in a different account.
This guide uses interactive Bash on Linux. Zsh, Fish, and shells inside containers have different configuration rules. Work in a terminal you can close without interrupting a job.
1. Check the shell and the history destination
printf 'Bash version: %sn' "$BASH_VERSION"
printf 'History file: %sn' "$HISTFILE"
printf 'Memory limit: %s; file limit: %sn' "$HISTSIZE" "$HISTFILESIZE"
set -o | grep history
shopt histappend
An empty Bash version means this is not the shell these instructions target. If the file path is empty, history has nowhere to go. Also check the account: commands entered in a root shell do not automatically appear in your ordinary user’s history.
The Bash manual distinguishes the in-memory list from the saved history file. It also explains that an unset history-file variable, an unwritable destination, or an overwriting exit can prevent the result you expect.
2. Inspect access without changing ownership blindly
if [ -n "$HISTFILE" ]; then
ls -ld -- "$(dirname -- "$HISTFILE")"
ls -l -- "$HISTFILE"
fi
A missing file can be normal before the first successful save. A file that belongs to another user needs investigation. Do not run a recursive ownership command on your home directory just to fix one history file. On a managed machine, ask the administrator why the ownership changed.
| Symptom | Check first |
|---|---|
| No commands survive a new session | History enabled, destination set, destination writable |
| Only older commands disappear | Memory and file limits |
| Commands from one terminal replace another’s | Append setting and custom prompt hooks |
| Only selected commands are absent | HISTCONTROL and HISTIGNORE filters |
3. Keep a useful amount of history
Back up ~/.bashrc with a new, unused backup filename. Open it in your preferred editor and find existing history settings before adding another block. For an interactive personal shell, these are reasonable starting values:
HISTSIZE=50000
HISTFILESIZE=100000
shopt -s histappend
These numbers are an editorial starting point, not a requirement. Adjust them to how you work. Avoid building an unlimited archive by habit: long histories contain old experiments, obsolete paths, and sometimes sensitive material.
Open a new Bash terminal to load the configuration. Keep the original terminal open until the test succeeds, so you can revert the edit if you made a mistake. This approach avoids re-running every command in an unfamiliar startup file inside an important working session.
4. Verify the fix with two terminals
In terminal A, enter a harmless marker, then append that session’s new entries:
echo adminhint-history-check
history -a
Open a new terminal B and look for the marker:
history | grep 'adminhint-history-chec[k]'
The bracketed search pattern avoids matching the search command itself. For an already-open terminal B, run history -n before searching. The history builtin documentation describes these append and read operations. We deliberately leave automatic prompt synchronization out of this fix: replacing PROMPT_COMMAND can interfere with an existing prompt or other shell hooks.
What this does not recover
If the old entries were never saved or have already been overwritten, increasing the limit will not recreate them. Check your own notes or backups instead. A successful marker test confirms the new save path; it does not prove every historical command has returned.
Keep API keys and passwords out of commands whenever possible. History filtering is useful housekeeping, but not a security boundary. If a real secret has been recorded and exposed, rotate it; deleting one visible entry does not remove every copy.
Related reading and topic credit
For more terminal basics, see our Linux command reference. The topic was prompted by How-To Geek’s Bash history article; this guide uses its own diagnostic sequence and examples.

