-8

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?

muru
  • 69,900
  • 13
  • 192
  • 292
  • 6
    It is probably downvoted because some users feel that it was too basic and that you should ideally study and test various solutions before asking. The best questions are on the form "I want to do _this_, so I tried _this_ but I get _this_ rather than what I expected, which is _this_." In your question, you give no clue as to how you tried opening the file, and what happened then. Also, be _very specific_.; there are probably no files called `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
  • Possible duplicate of [Bash history: "ignoredups" and "erasedups" setting conflict with common history across sessions](http://unix.stackexchange.com/questions/18212/bash-history-ignoredups-and-erasedups-setting-conflict-with-common-history) – MattyDaLinuxMan Mar 02 '17 at 13:29

1 Answers1

2

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).

Kusalananda
  • 320,670
  • 36
  • 633
  • 936