Here is my Controlled Assessment:
Show and explain the content of the file that contains the Bash history.
I typed ls -a
, but all it did was show files called Bash History which I couldn't open :(
So how do I do it then?
Here is my Controlled Assessment:
Show and explain the content of the file that contains the Bash history.
I typed ls -a
, but all it did was show files called Bash History which I couldn't open :(
So how do I do it then?
To show the history in bash
:
$ history
This will show the (in memory) history of the current shell.
$ cat "$HISTFILE"
This will output the history saved to this file by previous bash
sessions when they have exited (or written to the file under other circumstances).
See the bash
manual and search for variables therein that start with HIST
. These affect the format of the output of the history
command and the location and size of the history file as well as what is put into it.
You should also consult the same manual for an explanation of the history
command and when the history gets written to the history file (search the manual for history -s
). Also read the section called HISTORY
(search ^HISTORY
).
Bash History
, and if there were there would only be one (a directory can not hold multiple things with the same name). – Kusalananda Feb 23 '17 at 10:37