I have a linux box on amazon's aws EC2. I can view the user's bash_history here:
/home/ec2-user/.bash_history
However when I root in:
sudo -s
I do not get the root's bash_history. How can I view/find the bash_history for the admin user?
Thanks, Brett
In Bash, your command history is stored in a file ( . bash_history ) in your home directory.
The /root/. bash_history file consists of entries including commands run from Bash by user root or any remotely authenticated user who has Advanced Shell privilege.
In Linux, there is a very useful command to show you all of the last commands that have been recently used. The command is simply called history, but can also be accessed by looking at your . bash_history in your home folder. By default, the history command will show you the last five hundred commands you have entered.
bash_history located in the home directory of that user. I'm used to using the shortcut list via the up key on the keyboard which shows the last used command for that user. If you log in as root then you will be shown the history for the root user.
Here's the quick way:
sudo less /root/.bash_history
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