NVaughan (the OP) has already stated the answer in an update to the question: history behaves differently in bash than it does in zsh:
In short:
- zsh:
historylists only the 15 most recent history entrieshistory 1lists all – see below.
- bash:
historylists all history entries.
Sadly, passing a numerical operand to history behaves differently, too:
- zsh:
history <n>shows all entries starting with<n>– therefore,history 1shows all entries.- (
history -<n>– note the-– shows the<n>most recent entries, so the default behavior is effectivelyhistory -15)
- bash:
history <n>shows the<n>most recent entries.- (bash’s
historydoesn’t support listing from an entry number; you can usefc -l <n>, but a specific entry<n>must exist, otherwise the command fails – see below.)
Optional background info:
- In zsh,
historyis effectively (not actually) an alias forfc -l: seeman zshbuiltins- For the many history-related features, see
man zshall
- For the many history-related features, see
- In bash,
historyis its own command whose syntax differs fromfc -l- See:
man bash
- See:
- Both bash and zsh support
fc -l <fromNum> [<toNum>]to list a given range of history entries:- bash: specific entry
<fromNum>must exist. - zsh: command succeeds as long as least 1 entry falls in the (explicit or implied) range.
- Thus,
fc -l 1works in zsh to return all history entries, whereas in bash it generally won’t, given that entry #1 typically no longer exists (but, as stated, you can usehistorywithout arguments to list all entries in bash).
- bash: specific entry