show command history
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.)
Timestamp
In zsh, if you want to show timetstamp for each history, you can add "-i"
e.g. history -i
Reference
https://stackoverflow.com/questions/26846738/zsh-history-is-too-short
留言
張貼留言