CLI fundamentals
Theory: History
The more you work with the command line, the more often you need to repeat the commands you entered earlier. The easiest way to view the command history is to press the "up/down" keys. Each time you press the "up" arrow, the previously executed command will appear in the input field, if you press "down", the next command will appear.
The bash command history is stored in a special file called .bash_history, which lies in the user's home directory. Every time the user enters a command, it goes into that file. It is no different from the other files: you can open it, view it, and even edit it. The HISTFILESIZE environment variable is responsible for how many commands are stored in the history. If set, the number specified in it will be taken, otherwise, the history won't be cut off and the .bash_history file will grow "infinitely".
You can also view the history in a simpler way, just run the history command.
This command will display the contents of the .bash_history file, adding a number on the left. If you type history 5, only the last 5 commands entered are displayed. By using the command number in the history output, you can restart without having to type or copy the command from the history.
You can always grep the history if you need to:
Last, and most interesting, is the reverse-i-search (reverse interactive search). If you press Ctrl + r, a special history search will start. It waits for characters to be entered and immediately displays the closest command in which those characters occur. If you are not satisfied with the match, pressing Ctrl + r again will select the next match from the history.
The screenshot above is an advanced version of this search, working through the fzf utility.

