1
00:00:02,950 --> 00:00:08,200
In this session we will see, how you can see History of all the commands, which you have executed.

2
00:00:09,230 --> 00:00:15,830
So let's say for some reason you want to know all the commands, which you had executed previously.

3
00:00:15,860 --> 00:00:23,500
So in that case first thing is, you, if you just want to see last few commands, you can just scroll up.

4
00:00:23,510 --> 00:00:23,690
Okay.

5
00:00:23,690 --> 00:00:28,780
So basically you need to use Up Arrow Key and you will be able to see previous commands.

6
00:00:28,790 --> 00:00:29,050
Okay.

7
00:00:29,060 --> 00:00:36,320
That is one way. However, let's say if you want to see all the commands in a file or something similar

8
00:00:36,320 --> 00:00:38,650
to which is, which is likely in next history.

9
00:00:38,670 --> 00:00:39,050
command.

10
00:00:39,770 --> 00:00:44,910
Okay, so in that case you need to come out of this Redis client.

11
00:00:44,960 --> 00:00:50,850
You can exit from here and Redis client has something called Redis Client History File.

12
00:00:50,960 --> 00:00:51,520
Okay.

13
00:00:51,650 --> 00:00:57,550
That is a file where it maintains all the commands which has been performed historically.

14
00:00:57,590 --> 00:01:02,690
So in that case, you need to move to your users Home directory. So whichever user you are using to run

15
00:01:02,690 --> 00:01:06,020
Redis cli,  go to the Home Directory of that user.

16
00:01:06,980 --> 00:01:12,460
So if you do cd  ~ ,then it is going to take you to the Home Directory of the user.

17
00:01:12,920 --> 00:01:18,860
If you do pwd, now you can see you are into /home/redisadmin

18
00:01:18,860 --> 00:01:21,240
You need to do a ls-lrta,

19
00:01:22,250 --> 00:01:27,470
and once you do that, you should be seeing a file which is starting with Dot.

20
00:01:27,470 --> 00:01:29,170
That is the reason it is the Hidden File.

21
00:01:29,990 --> 00:01:35,470
So it is starting with .  and File Name is rediscli _history.

22
00:01:35,530 --> 00:01:39,350
So this is a file which maintains all the commands.

23
00:01:39,370 --> 00:01:47,830
So if I want to see last 100 commands which, I have executed.  So I can do tail- 100  and give

24
00:01:47,830 --> 00:01:49,120
the name of this file. Okay.

25
00:01:49,720 --> 00:01:56,760
So these are the commands which we had executed previously and this is output which I get.  So let's say

26
00:01:56,770 --> 00:02:02,010
if you want to, now if you had run this command on, let's say one of the Development Server and if

27
00:02:02,010 --> 00:02:05,960
you want to perform the same set of activity on any other server.

28
00:02:06,210 --> 00:02:12,810
In that case you can just paste all these commands  in a script, in a Shell script and then you can

29
00:02:12,810 --> 00:02:14,070
verify the command.

30
00:02:14,310 --> 00:02:21,240
And after that, you can just execute this command, using some script. So that way also it is useful and

31
00:02:21,240 --> 00:02:27,750
if we just want to see, what  are the previous commands, you have executed and you just want to re execute

32
00:02:27,750 --> 00:02:30,660
that, then you can do that as well.
