Tuesday, April 30, 2024
70
rated 0 times [  70] [ 0]  / answers: 1 / hits: 334658  / 3 Years ago, mon, november 8, 2021, 2:33:01

I want to view the contents of my .bash_history file but don't know how to get there via the command line.


More From » command-line

 Answers
1

If you want to access the actual file itself, just use your favorite text editor (I use emacs but you can use pluma of gedit or vimor whatever):



emacs ~/.bash_history


That is the default location if your history file. If you don't find anything there, you may have changed the history file's name. This is stored in the $HISTFILE variable, so print it out to check its current value:



echo $HISTFILE





If, instead of the file, you just want to see your history, you can run history as @minerz029 suggested. The history command with no options just prints the contents of your $HISTFILE followed by the commands executed in the current shell that have not yet been written to that file, with line numbers.


[#29024] Wednesday, November 10, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
impisaso

Total Points: 423
Total Questions: 106
Total Answers: 104

Location: Virgin Islands (U.S.)
Member since Tue, Feb 2, 2021
3 Years ago
;