In this session we will see, how you can see History of all the commands, which you have executed.
So let's say for some reason you want to know all the commands, which you had executed previously.
So in that case first thing is, you, if you just want to see last few commands, you can just scroll up.
Okay.
So basically you need to use Up Arrow Key and you will be able to see previous commands.
Okay.
That is one way. However, let's say if you want to see all the commands in a file or something similar
to which is, which is likely in next history.
command.
Okay, so in that case you need to come out of this Redis client.
You can exit from here and Redis client has something called Redis Client History File.
Okay.
That is a file where it maintains all the commands which has been performed historically.
So in that case, you need to move to your users Home directory. So whichever user you are using to run
Redis cli, go to the Home Directory of that user.
So if you do cd ~ ,then it is going to take you to the Home Directory of the user.
If you do pwd, now you can see you are into /home/redisadmin
You need to do a ls-lrta,
and once you do that, you should be seeing a file which is starting with Dot.
That is the reason it is the Hidden File.
So it is starting with . and File Name is rediscli _history.
So this is a file which maintains all the commands.
So if I want to see last 100 commands which, I have executed. So I can do tail- 100 and give
the name of this file. Okay.
So these are the commands which we had executed previously and this is output which I get. So let's say
if you want to, now if you had run this command on, let's say one of the Development Server and if
you want to perform the same set of activity on any other server.
In that case you can just paste all these commands in a script, in a Shell script and then you can
verify the command.
And after that, you can just execute this command, using some script. So that way also it is useful and
if we just want to see, what are the previous commands, you have executed and you just want to re execute
that, then you can do that as well.