1825771 Members
2301 Online
109687 Solutions
New Discussion

check history

 
SOLVED
Go to solution
juno2
Super Advisor

check history

I login as root user and run some command on the shell , how can I check back my history - what command I have ran ? I check it on the file /.sh_history , but what is in linux ? thx.
4 REPLIES 4
Vitaly Karasik_1
Honored Contributor

Re: check history

in bash you can use arrow buttons for walking into your history, history file itself is .bash_history


Vitaly
Sergejs Svitnevs
Honored Contributor

Re: check history

The command "history" is the sequential list of commands you have typed, in the current or previous shell sessions. The command history is stored in a text file in the home directory called ".bash_history" (root: "/root/.bash_history").
By default, bash remembers the last 500 events.

Regards,
Sergejs
Balaji N
Honored Contributor
Solution

Re: check history

check out /root/.bash_history.

and by default on a RHL box it is 1000 (set in /etc/profile)

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Jerome Henry
Honored Contributor

Re: check history

And you can read it by
cat /root/.bash_history | more
or
vim /root/.bash_history
(':q!' to go away from Vim if you are not familiar with it. SAme command on profile to change the value from 1000 to something else, but do not be too greedy on history size).

Jerome (celebrating my new cap : can I have it in read instead of green ?)
You can lean only on what resists you...