I am fairly new to Linux and I need to find a way to show the contents of my Bash History via the command line, and unfortunately I can't seem to find anything that works, or that I can understand. I am using Linux Ubuntu 11.10, and when I open the Bash History manually by finding the file, it opens with something known as gedit. How will I be able to view the contents of my Bash History via the command line? Many Thanks! ~ShadedVeil
Asked
Active
Viewed 1.0k times
2 Answers
0
$history
and it will show the history
1999 exit
2000 cd /opt
2001 sudo apt-get install p7zip-full
2002 sudo apt-get install p7zip-rar
2003 mkdir CS-RT-code
2004 cd CS-RT-code/
2005 ls -lrt
2006 history
$ !<history #> to execute the previous history command
Ashu
- 4,004
0
less is a pretty useful command evolved from more. You can use it to browse through large text files. Run:
less $HOME/.bash_history
Use the Up/Down arrow keys to go up and down in the file. Press q to exit.
For more information/keyboard shortcuts in less, run man less. It will show its manual pages.
For instance, you could also use other utilities, such as cat (cat $HOME/.bash_history), more (more $HOME/.bash_history), nano (nano $HOME/.bash_history) and Vim (vim $HOME/.bash_history).
Eduardo Cola
- 5,876
- 3
- 20
- 33