I'm trying to view all commands that I've entered into the unix environment in my Git Bash.
So I'm not trying to view the list of possible commands for Git Hub. Neither am I trying to view the logs for pushes and pulls.
I just want to view what I entered in the command line. This is because I recently encountered a connection problem in which I couldn't push or pull from my git. It just happened suddenly. One minute ago, I was still pushing and pulling perfectly.
Then, someone helped me to resolve it via the command prompt in git bash.
Right now, my friend has the same problem. So I'm looking for the command logs in hopes that it will solve his problem too.
Write failed: Broken pipe fatal: The remote end hung up unexpectedly.
Open up a terminal window and issue the command cd /var/log. Now issue the command ls and you will see the logs housed within this directory (Figure 1).
Open Start. Search for Command Prompt, and click the top result to open the console. Type the following command to view the command history and press Enter: doskey /history.
Linux logs will display with the command cd/var/log. Then, you can type ls to see the logs stored under this directory. One of the most important logs to view is the syslog, which logs everything but auth-related messages.
You can do this with cat $HISTFILE
.
Bash by default stores the last 500 commands in a history file, most likely called ~/.bash_history. This file is in the variable $HISTFILE (and the size is in $HISTFILESIZE). You can get the path to the history file with echo $HISTFILE
.
If you are still in the shell a quick way to see your recent session command history is the command:
$ history
Very handy for the scenario mentioned in the question, i.e. a colleague has typed some commands quickly in your session and you want to go back and have a closer look at them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With