1
00:00:00,770 --> 00:00:06,230
Computers in the past didn't have a graphical user interface as they have today.

2
00:00:06,740 --> 00:00:16,460
So today we can use our mouse cursor, we can click on widgets, we can fill in text boxes, click on

3
00:00:16,460 --> 00:00:23,060
buttons, etc. So what we use today is the graphical user interface of the operating system.

4
00:00:23,750 --> 00:00:30,820
But back then, our ancestors, well, our older colleagues didn't have a graphical user interface.

5
00:00:30,830 --> 00:00:36,440
All they had to was a C, L, a command line interface.

6
00:00:36,440 --> 00:00:42,860
So they communicated with the computers using commands only text commands.

7
00:00:43,250 --> 00:00:48,950
This command line interface, though, is still here in our computers.

8
00:00:49,160 --> 00:00:59,000
So if you go to your start menu on Windows or Mac or Linux and search for CMD or terminal on Mac or

9
00:00:59,000 --> 00:00:59,720
Linux.

10
00:01:00,110 --> 00:01:04,099
So you should be able to open that same command line.

11
00:01:04,099 --> 00:01:11,000
And in this command line you can navigate through your computer and you can still use your computer.

12
00:01:11,030 --> 00:01:16,660
However, normally users don't really need to use this command line.

13
00:01:16,670 --> 00:01:17,630
Nowadays.

14
00:01:17,630 --> 00:01:23,420
The command line is only used by computer admins or programmers.

15
00:01:23,420 --> 00:01:31,160
So as a programmer it is important for you to know the main commands that you can use on a command line

16
00:01:31,160 --> 00:01:32,090
interface.

17
00:01:32,420 --> 00:01:33,830
Why is that important?

18
00:01:33,860 --> 00:01:40,430
Well, because sometimes, for example, we used the Heroku servers to deploy a web app.

19
00:01:40,550 --> 00:01:47,260
Now Heroku is a server, so we don't have access to its graphical user interface.

20
00:01:47,270 --> 00:01:50,360
We only have access to its command line interface.

21
00:01:50,360 --> 00:01:58,430
So if you want to deploy your apps, your programs, your your code to a remote server, the only option

22
00:01:58,430 --> 00:02:04,820
you have is to control that remote server through the command line interface.

23
00:02:05,000 --> 00:02:09,949
That's why in this video I'll teach you how to use a command line interface.

24
00:02:10,220 --> 00:02:18,860
So if you are on windows, please close the window command prompt and you should open the git bash.

25
00:02:19,190 --> 00:02:22,730
So I assume you have installed git already.

26
00:02:23,000 --> 00:02:26,780
If not, please search for git download on google.

27
00:02:26,930 --> 00:02:32,120
Go to the first page downloads and then go to windows.

28
00:02:32,120 --> 00:02:39,230
So download for windows and that should download either a 32 bit or a 64 bit git executable.

29
00:02:39,230 --> 00:02:41,600
So then you should install that executable.

30
00:02:41,870 --> 00:02:43,130
Just click on next, next.

31
00:02:43,130 --> 00:02:43,520
Next.

32
00:02:43,550 --> 00:02:50,240
If you have troubles, you can look at the programming tool lecture in day 15.

33
00:02:50,240 --> 00:02:55,280
There is where I showed you how to install it, so I have installed git already.

34
00:02:55,280 --> 00:03:00,610
So once you install git then you can search for git bash and open that.

35
00:03:00,620 --> 00:03:02,690
So this now is.

36
00:03:05,550 --> 00:03:07,260
So that is for Windows users.

37
00:03:07,260 --> 00:03:13,650
For Mac and Linux users, please search for the terminal app and open the terminal app.

38
00:03:13,830 --> 00:03:21,000
So both the Gate bash and the terminal app can be used to work on your computer or on a server.

39
00:03:21,000 --> 00:03:27,600
It doesn't matter if it's a local computer or server, so you can use the git bash or the terminal to

40
00:03:27,600 --> 00:03:34,740
do things like create new files, delete files, go to a certain directory, edit, text files, etc.

41
00:03:34,740 --> 00:03:43,350
So once you open the gate, bash or the terminal, then the terminal or the git bash will point to a

42
00:03:43,350 --> 00:03:51,240
certain directory to find that out what directory you are currently press TWD and that will tell you

43
00:03:51,240 --> 00:03:52,680
where you are.

44
00:03:52,680 --> 00:03:55,350
So I'm currently at C users.

45
00:03:55,350 --> 00:04:02,670
AS So that's the first command you just learned p w d that prints out the current directory where you

46
00:04:02,670 --> 00:04:08,010
are in your computer because at any time the command line interface points to a certain directory.

47
00:04:08,010 --> 00:04:16,890
So anything we do now, for example, let's create a file, one text file, anything we do now is going

48
00:04:16,890 --> 00:04:22,140
to be applied to that current directory, in this case, that directory.

49
00:04:22,230 --> 00:04:29,310
So if I do touch file one, the TXT and press enter that will create a new file.

50
00:04:29,310 --> 00:04:30,360
One txt.

51
00:04:30,390 --> 00:04:34,950
So touch is the second command you just learned that is used to create new files.

52
00:04:35,040 --> 00:04:38,100
Now you'd say, well, how do we see these files?

53
00:04:38,100 --> 00:04:42,240
Well, to see the files you have in the current directory.

54
00:04:42,240 --> 00:04:46,320
The current directory is that one again, you should press ls.

55
00:04:47,010 --> 00:04:47,970
So there you go.

56
00:04:47,970 --> 00:04:53,340
I have many files here and one of them is file one txt.

57
00:04:53,370 --> 00:04:56,790
So that's the file that I've just created and it's an empty file for now.

58
00:04:57,030 --> 00:05:04,920
Let's create a second file touch file to the txt and let's create a third file touch file.

59
00:05:04,950 --> 00:05:06,300
Free that pie.

60
00:05:06,300 --> 00:05:07,980
Let's call this pie.

61
00:05:08,370 --> 00:05:13,860
Now, if you want to know only the text files, if you want to get a list of only the text files you

62
00:05:13,860 --> 00:05:22,560
have in the current folder, you can do ls asterisk dot text press enter and that will list all the

63
00:05:22,560 --> 00:05:24,690
text files you have in this directory.

64
00:05:24,690 --> 00:05:29,910
Actually, only the files that end with a dot text extension to be clear about that.

65
00:05:29,910 --> 00:05:37,230
So that command is saying, Oh, give me a list of all the files that have anything in front and then

66
00:05:37,230 --> 00:05:39,600
they end with that text.

67
00:05:39,630 --> 00:05:48,060
So touch was how to create a new file and to create a new directory you do m k dir followed by the name

68
00:05:48,060 --> 00:05:50,100
of the directory, let's say data.

69
00:05:50,960 --> 00:05:52,910
All right, so I've just created a directory.

70
00:05:52,930 --> 00:06:01,000
However, know that you're still in the current directory as we have been since the start of the Common

71
00:06:01,000 --> 00:06:02,110
Line interface.

72
00:06:02,320 --> 00:06:09,430
Now, if you want to do something inside the data directory, first, you need to go inside the data

73
00:06:09,430 --> 00:06:09,910
directory.

74
00:06:09,910 --> 00:06:13,390
You need to change the current directory to that directory.

75
00:06:13,420 --> 00:06:21,070
To do that, you use a seed which stands for change Directory seed data.

76
00:06:21,990 --> 00:06:23,280
Be careful with the typos.

77
00:06:23,280 --> 00:06:25,930
If you miss something, things will not work.

78
00:06:25,950 --> 00:06:30,390
So I created the data folder here, and I'm going to that folder now.

79
00:06:30,780 --> 00:06:36,300
With that, you'll see that in here the path changed to data.

80
00:06:36,300 --> 00:06:41,700
And you can also double check that with p wd the command and it will tell you that you are currently

81
00:06:41,700 --> 00:06:42,720
inside data.

82
00:06:43,200 --> 00:06:48,090
This is an empty folder, so if you do less, you're going to get nothing in return.

83
00:06:48,090 --> 00:06:57,330
So no files here currently, but any file you create now, such as file ten txt, any file you create

84
00:06:57,330 --> 00:07:00,540
will be created inside this data directory.

85
00:07:00,540 --> 00:07:04,330
So with ls you should get file 10.60.

86
00:07:04,350 --> 00:07:13,470
That's the only file we have now inside data to go back one directory level you can use CD space followed

87
00:07:13,470 --> 00:07:19,590
by two dots, two periods that will take you back to the previous directory.

88
00:07:19,770 --> 00:07:22,110
So just check it with p.w dx.

89
00:07:22,140 --> 00:07:30,120
So if you do LS now you're going to get the files of the C users as directory.

90
00:07:30,120 --> 00:07:37,650
So we so how to see where we are currently with p.w dx we so how to list the contents of a directory

91
00:07:37,650 --> 00:07:46,800
with LS we so How to create new files with touch and create new directory with m k dear Now How to remove

92
00:07:46,800 --> 00:07:52,470
a file To remove a file you use our m followed by the name of the file.

93
00:07:52,470 --> 00:07:55,230
For example, file one dot.

94
00:07:55,260 --> 00:07:57,690
Now here is the trick I want to show to you.

95
00:07:58,770 --> 00:08:01,350
If you want to alter complete a file name.

96
00:08:01,350 --> 00:08:06,900
For example, you do file one and you don't want to type all the name through.

97
00:08:06,930 --> 00:08:12,750
You may press the tab key on your keyboard and that will autocomplete the file name.

98
00:08:12,840 --> 00:08:19,850
So file one the txt and then press enter and that will remove it will delete file one txt.

99
00:08:20,010 --> 00:08:22,470
So if I do ls now file one.

100
00:08:22,470 --> 00:08:24,570
The text is not here anymore.

101
00:08:25,260 --> 00:08:33,990
If you want to remove a directory which has content inside for example the data directory, we can use

102
00:08:34,110 --> 00:08:41,520
our m r followed by the name of the directory data press enter.

103
00:08:41,520 --> 00:08:44,940
And now data is not part of.

104
00:08:46,030 --> 00:08:47,380
This folder anymore.

105
00:08:48,650 --> 00:08:53,880
So you can try to do seed data, but you will get an error.

106
00:08:53,900 --> 00:08:57,710
It says no such file or directory because we deleted it in here.

107
00:08:58,280 --> 00:08:59,920
How to rename a file?

108
00:08:59,930 --> 00:09:11,150
Well, let's create a new file first touch file 20 dot txt to rename this file 2036 t to file 30 the

109
00:09:11,150 --> 00:09:21,530
txt you use the v command followed by the name of the file you want to rename file 20 the txt and after

110
00:09:21,530 --> 00:09:28,430
that goes the new name you want to give to this file file 30 dot txt press enter and less and you'll

111
00:09:28,430 --> 00:09:34,610
see that file 30 The txt exists here, but file 20 has been removed.

112
00:09:35,180 --> 00:09:40,370
So basically what M.V. is is actually a move command.

113
00:09:40,370 --> 00:09:44,810
It moves a file from one file path to a new file path.

114
00:09:44,810 --> 00:09:52,670
So that means you can also move file 30 the txt to a new directory for example data.

115
00:09:52,670 --> 00:10:01,490
So let's create the data directory again with mkdir data and then move file 30.

116
00:10:03,610 --> 00:10:11,350
So if you press tab while you have just typed some part of the name, for example, I typed in file

117
00:10:11,350 --> 00:10:16,210
three and then I press tab and it showed me this.

118
00:10:16,750 --> 00:10:25,240
So it didn't autocomplete the name to 530 to 60 because there are other files which have this name.

119
00:10:25,240 --> 00:10:26,780
For example, file three.

120
00:10:26,800 --> 00:10:33,850
So the command line interface doesn't know if you want to autocomplete this file or that file, but

121
00:10:33,850 --> 00:10:40,120
if you specify a zero then tab, then it knows that you want to autocomplete that one.

122
00:10:40,870 --> 00:10:41,530
So.

123
00:10:41,530 --> 00:10:47,350
Oh, I pressed the enter command, but I had to also give the destination of the file.

124
00:10:47,350 --> 00:10:50,020
So this is not the correct command.

125
00:10:50,020 --> 00:10:52,780
You need to put the destination file.

126
00:10:52,780 --> 00:11:00,460
So data file 30 dot txt and that will move that file to that directory.

127
00:11:00,490 --> 00:11:06,580
You can also check the contents of a directory without being in that directory.

128
00:11:06,580 --> 00:11:14,070
So currently we are in this directory s and we can check ls data.

129
00:11:14,080 --> 00:11:21,100
By specifying the name of the folder, we can check for the files contained in that directory To copy

130
00:11:21,100 --> 00:11:23,410
a file, you use a CPP command.

131
00:11:23,440 --> 00:11:24,310
Let's copy.

132
00:11:24,310 --> 00:11:27,790
For example, file three, file three.

133
00:11:27,790 --> 00:11:28,480
That's P.

134
00:11:28,840 --> 00:11:30,730
Let's copy it to data.

135
00:11:31,000 --> 00:11:33,100
File three dot P.

136
00:11:34,180 --> 00:11:36,640
Let's check data with LS data.

137
00:11:36,670 --> 00:11:37,870
And there we go.

138
00:11:37,900 --> 00:11:39,850
53. py is there.

139
00:11:40,210 --> 00:11:47,740
Lastly, let's talk about how to view and how to edit the contents of text files with text files.

140
00:11:47,740 --> 00:11:56,560
I mean any non-binary files such as dot, txt, dot, py, html, dot, Jason all the files which have

141
00:11:56,560 --> 00:11:57,940
texts inside.

142
00:11:57,940 --> 00:12:03,640
So to open a file for editing, you can use the nano command.

143
00:12:03,970 --> 00:12:05,530
So let's create a file first.

144
00:12:05,650 --> 00:12:09,550
Let's say touch file 50 dot p one.

145
00:12:10,000 --> 00:12:11,920
So we have just created a file.

146
00:12:11,950 --> 00:12:20,830
Now to open that file we use nano file 50 dot p y that will open the nano text editor.

147
00:12:20,830 --> 00:12:26,410
So Nano is a text editor which works inside a command line interface.

148
00:12:26,410 --> 00:12:34,270
So here you can simply type in text like that, You can press, enter, go to the next line press escape.

149
00:12:34,840 --> 00:12:41,200
You cannot even click on somewhere else with your cursor, but you can use your arrow keys to move up

150
00:12:41,200 --> 00:12:41,920
and down.

151
00:12:43,030 --> 00:12:44,020
So like that.

152
00:12:47,080 --> 00:12:48,280
So we can write something.

153
00:12:48,300 --> 00:12:57,490
He'll, for example, print Hello and to save and exit this you can use control X.

154
00:12:57,490 --> 00:12:59,530
You see these commands here.

155
00:13:00,100 --> 00:13:06,970
So that symbol means you need to press the control key on your keyboard, followed by that letter.

156
00:13:06,970 --> 00:13:14,080
In our case, we want to exit with control X, so control X that will ask us if we want to save the

157
00:13:14,080 --> 00:13:14,710
buffer.

158
00:13:15,010 --> 00:13:17,740
If you want to save, it's press y.

159
00:13:17,740 --> 00:13:21,280
If not press nn otherwise press control.

160
00:13:21,310 --> 00:13:24,910
C to cancel and go back to the editor.

161
00:13:24,910 --> 00:13:27,610
So I'll press y then.

162
00:13:27,610 --> 00:13:33,220
This asks you if you want to keep the file name as it is here or you want to change it.

163
00:13:33,220 --> 00:13:36,340
If you want to keep it, you need to press enter.

164
00:13:36,640 --> 00:13:45,730
So what we just did is we added some text to this dot p file and that's something you could also do

165
00:13:45,730 --> 00:13:47,440
in a remote server.

166
00:13:47,620 --> 00:13:55,120
So the remote server gives you access to its command line interface and you can edit your files using

167
00:13:55,120 --> 00:13:56,920
the nano text editor.

168
00:13:57,100 --> 00:14:03,790
If you simply want to see the contents of a file just to view it, you can use cat followed by the name

169
00:14:03,790 --> 00:14:05,980
of the file file 50.

170
00:14:06,340 --> 00:14:07,030
That's p y.

171
00:14:07,030 --> 00:14:11,110
In this case, press enter and that will print out the contents of that file.

172
00:14:11,110 --> 00:14:12,700
In our case it is print.

173
00:14:12,700 --> 00:14:13,300
Hello.

174
00:14:13,690 --> 00:14:21,460
And Cat was the last command you needed to learn for today as part of the most important commands.

175
00:14:21,460 --> 00:14:26,680
So all these, by the way, all these were Unix commands.

176
00:14:26,890 --> 00:14:35,380
Now these UNIX commands work on Linux operating systems, Mac operating systems, and also Windows operating

177
00:14:35,380 --> 00:14:35,860
system.

178
00:14:35,860 --> 00:14:43,900
When you use some tools such as the Git bash, Windows has its own command line as well, which you

179
00:14:43,900 --> 00:14:51,580
can find it in here with CMD or PowerShell and these will be slightly different commands.

180
00:14:51,580 --> 00:14:59,440
However, they are not as useful for a programmer as there are the Linux commands because most of the

181
00:14:59,440 --> 00:15:03,610
servers you'll deploy your apps to will be based on Linux.

182
00:15:03,610 --> 00:15:11,920
Windows commands are more useful for system administrators who manage Windows servers.

183
00:15:11,920 --> 00:15:15,520
So for programmers, Linux will be the industry standard.

184
00:15:15,520 --> 00:15:18,100
So I hope you find this useful and I'll see you later.

185
00:15:18,100 --> 00:15:18,610
Thanks.

