December 2018
Beginner
452 pages
12h 17m
English
A very powerful and cool command in Bash is history. Simply put, by default, Bash will store a history of all the commands you type. These are saved up to a certain threshold, and for our Ubuntu 18.04 installation this is 1,000 commands in memory and 2,000 commands on disk. Every time you do a clean exit/logout of your terminal, Bash will write the command history from memory to disk, taking both limits into account.
Before we dive (a little) deeper, let's take a look at our personal history for the reader user:
reader@ubuntu:~$ history 1013 date 1014 at 11:49 << wall "Hi" 1015 at 11:49 <<< wall "Hi" 1016 echo 'wall "Hi"' | at 11:49<SNIPPED> 1998 array=("This" "is" "an" "array") 1999 echo ${array[0]} 2000 echo ${array[1]} ...