1
00:00:00,240 --> 00:00:05,970
Now that we've talked about what the command line is and why it's important and useful Let's actually

2
00:00:05,970 --> 00:00:07,140
learn how to use it.

3
00:00:07,170 --> 00:00:12,810
So I'm going to start by introducing a few of the most important commands which have to do with navigating

4
00:00:12,870 --> 00:00:18,240
files and folders structures and to do that we need to have a few files that we can interact with in

5
00:00:18,420 --> 00:00:20,300
folders to navigate through.

6
00:00:20,310 --> 00:00:27,330
So I'm going to create a new folder here in cloud 9 and go over to my workspace here and right click

7
00:00:28,410 --> 00:00:34,860
and click on new folder and that creates a new folder instead of my Web Dev Bootcamp which is the name

8
00:00:34,860 --> 00:00:35,940
of my workspace.

9
00:00:35,940 --> 00:00:39,800
Everything we do will be a folder instead of Dev Bootcamp.

10
00:00:39,900 --> 00:00:45,490
So I'm going to make a new folder here and just call it intro to command line.

11
00:00:46,080 --> 00:00:50,860
And this is where it will make some of our files and practice some of the command line basics.

12
00:00:51,330 --> 00:00:52,580
So I'll make that.

13
00:00:52,710 --> 00:00:59,820
And then inside of Intro to command line I mean right click on that and click new file and we'll just

14
00:00:59,820 --> 00:01:06,060
call this message and we'll make it a t t file just text.

15
00:01:06,160 --> 00:01:07,770
Just like that.

16
00:01:08,130 --> 00:01:12,570
And then I'm going to double click on that file and just add a quick message in there and it can be

17
00:01:12,570 --> 00:01:13,570
anything you want.

18
00:01:13,830 --> 00:01:16,550
Hello from the message.

19
00:01:16,680 --> 00:01:20,910
60 file and we'll save it.

20
00:01:20,970 --> 00:01:26,130
You can see that it's unsaved because I get this little circle right there and when it's saved you'll

21
00:01:26,130 --> 00:01:28,520
see that it goes away to save it though.

22
00:01:28,530 --> 00:01:33,950
I can either do file save or it can use the shortcut that it shows next to it.

23
00:01:33,960 --> 00:01:35,790
So for me that's command s.

24
00:01:36,060 --> 00:01:41,640
So I'll do that now command as you can see that that little circle that was there is gone now.

25
00:01:41,760 --> 00:01:49,050
So I've saved the file now that I have a folder and a single file inside of it that I created with my

26
00:01:49,050 --> 00:01:53,810
mouse I right clicking which I did not use a command line to do any of that.

27
00:01:53,820 --> 00:01:56,790
Now that we have a folder and a file to work with.

28
00:01:56,910 --> 00:02:02,520
Let's talk about the command line and how we can use a command line to interact with those directories

29
00:02:02,730 --> 00:02:04,110
and the file.

30
00:02:04,110 --> 00:02:06,250
So we're going to go to the command line here.

31
00:02:06,330 --> 00:02:10,030
The first thing I want to demonstrate is a command called l s.

32
00:02:10,200 --> 00:02:16,230
So we type the letters L N S No spaces just ls and hit enter.

33
00:02:16,230 --> 00:02:22,920
And what it shows us is all of the contents of the current folder that were inside of and the current

34
00:02:22,920 --> 00:02:26,100
folder I'm inside of is called workspace.

35
00:02:26,100 --> 00:02:31,210
You can see here workspace is a little weird but think of it it's the top level.

36
00:02:31,290 --> 00:02:39,060
It's the highest up we can go in our entire workspace is this workspace folder and it shows me this

37
00:02:39,060 --> 00:02:42,170
little message right here says I'm in workspace.

38
00:02:42,840 --> 00:02:50,640
So LS stands for list and it just shows me all the files and folders of my current folder and I'm currently

39
00:02:50,820 --> 00:02:51,610
right here.

40
00:02:51,810 --> 00:02:56,220
And so all that I can see is intro to commendably so I'll type it one more time.

41
00:02:56,250 --> 00:03:01,170
LS And I get a folder here called the intro to command line.

42
00:03:01,710 --> 00:03:07,630
The next important command is CD and what CD lets this do is change directories.

43
00:03:08,040 --> 00:03:16,530
It's how I could go inside of Intro to command line to UCD we type the letters C and D space and then

44
00:03:16,560 --> 00:03:20,710
the name of the folder or directory that we want to change into.

45
00:03:20,730 --> 00:03:27,030
So we have to tell it the name of the folder so we can hit LS again and you'll see that intro to command

46
00:03:27,030 --> 00:03:29,100
line is now spelled correctly.

47
00:03:29,100 --> 00:03:34,320
Whereas before when I hit LS It was showing me the old file name or the old directory name.

48
00:03:34,350 --> 00:03:35,390
And then I changed it.

49
00:03:35,490 --> 00:03:40,270
So I typed LS again and this just shows me what it is now.

50
00:03:40,290 --> 00:03:49,200
So to change directory I need to type CD and then intro to command line make sure it's spelled correctly

51
00:03:49,470 --> 00:03:51,420
and is capitalized the same way.

52
00:03:51,420 --> 00:03:56,660
And then I'll hit enter and you'll see that my prompt changes.

53
00:03:56,760 --> 00:04:03,060
Now it shows that instead of workspace slash intro to command line instead of Intro to command line

54
00:04:03,210 --> 00:04:09,410
if I want to list the files and directories I just type LS again and hit enter.

55
00:04:09,550 --> 00:04:14,850
And now you can see that I'm listing all the files and there's only one message dot TXI.

56
00:04:15,840 --> 00:04:23,430
And I can click on Message that text here and click open and it opens it up here for me and it's already

57
00:04:23,430 --> 00:04:30,570
open so if I close out of it and now a click on Message that text and click Open it opens it for me

58
00:04:30,600 --> 00:04:36,580
and I can edit it if I want to add in goodbye and save.

59
00:04:36,900 --> 00:04:38,590
And we can close out.

60
00:04:39,140 --> 00:04:43,520
Now let's create a nother file inside of Intro to command line.

61
00:04:44,010 --> 00:04:45,740
And I'm just going to go over here again.

62
00:04:45,810 --> 00:04:54,240
And right click and go to new file and the file I'm going to create is called Hello that age DML and

63
00:04:54,240 --> 00:04:55,960
hit enter.

64
00:04:55,980 --> 00:05:03,720
Now if I come here and I type LS You can see that I have a haloed that h t m l and I'm going to open

65
00:05:03,720 --> 00:05:07,000
that in my editor and I'll add in some simple h t m l

66
00:05:09,810 --> 00:05:15,120
just like that and save and close out of it.

67
00:05:15,190 --> 00:05:22,020
So if I hit LS again I still have two files if I go over here you can see the exact same files and structure

68
00:05:22,020 --> 00:05:22,410
.

69
00:05:22,420 --> 00:05:28,990
Basically it's just another interface here I'm doing it through text and the command line here I'm viewing

70
00:05:28,990 --> 00:05:38,080
things as a folder structure similar to the Finder window on a Mac to go backwards a folder or up one

71
00:05:38,070 --> 00:05:38,690
level.

72
00:05:38,700 --> 00:05:47,080
So I'm inside of Intro to command line and if I wanted to then be here I can use CD again but I don't

73
00:05:47,070 --> 00:05:55,650
have a folder named to type I type CD space dot dot and you can see when I do that I was in Intro to

74
00:05:55,650 --> 00:05:56,890
command line.

75
00:05:56,920 --> 00:06:03,090
Now I'm just in workspace so CD that takes me back one level and if I type.

76
00:06:03,100 --> 00:06:11,160
LS Now you can see I'm back here where the only folder is intro to command line so I can CD back in

77
00:06:11,400 --> 00:06:14,800
CD enter to command line type.

78
00:06:14,800 --> 00:06:17,530
LS You can see the two files there.

79
00:06:17,640 --> 00:06:19,050
Hello to each team now.

80
00:06:19,070 --> 00:06:20,730
Message TXI.

81
00:06:21,150 --> 00:06:23,080
Let's create a new folder.

82
00:06:23,400 --> 00:06:28,140
So right click new folder and we'll just call it colors.

83
00:06:28,300 --> 00:06:31,680
So a folder called colors and hit enter.

84
00:06:31,690 --> 00:06:36,720
Now if I hit LS here you can see I have message that takes t.

85
00:06:36,780 --> 00:06:37,440
Hello Daddy.

86
00:06:37,440 --> 00:06:40,630
Tim L and a directory called colors.

87
00:06:40,890 --> 00:06:46,690
And notice how it changes the color of a directory it makes it blue and adds the slash afterwards so

88
00:06:46,690 --> 00:06:50,840
that we can tell if something is a folder or if it's a file.

89
00:06:51,150 --> 00:06:57,440
And then I could also see into colors just like that and hit enter.

90
00:06:57,490 --> 00:07:01,870
And if I type LS There's nothing here because there are no files.

91
00:07:01,870 --> 00:07:09,120
So one more time I'll make a new file right quick new file and we'll call this red dot TXI.

92
00:07:09,630 --> 00:07:19,560
And now if I type LS You can see I get red x t and then I can back out one level C-D dot dot and I'm

93
00:07:19,560 --> 00:07:23,350
now in Intro to command line right here.

94
00:07:23,400 --> 00:07:25,020
So I was right here.

95
00:07:25,020 --> 00:07:26,320
Now I'm here.

96
00:07:26,910 --> 00:07:29,680
So if I type LS I see the colors directory.

97
00:07:29,680 --> 00:07:32,310
Hello H shemale message that text.

98
00:07:32,520 --> 00:07:40,740
Now if I do see the dot dot one more time I'm now back in the workspace where if I type LS all I see

99
00:07:40,750 --> 00:07:42,480
is intro to command line.

100
00:07:42,490 --> 00:07:47,440
I might be thinking that it's a pain to have to type intro to command line if I want to change directory

101
00:07:47,450 --> 00:07:48,690
and I have to type the whole thing.

102
00:07:48,760 --> 00:07:53,140
CD intro to command line just like that.

103
00:07:53,470 --> 00:07:55,110
But there's actually a much quicker way.

104
00:07:55,120 --> 00:08:02,670
So if I cd back out and I type LS It's still there I can type CD and start to type the name and then

105
00:08:02,680 --> 00:08:06,500
hit tab and then automatically completes it for me.

106
00:08:06,570 --> 00:08:08,560
So that makes it really fast.

107
00:08:08,560 --> 00:08:16,030
So for instance if I wanted to CD into intro to command line I can just type CDI and hit tab and then

108
00:08:16,020 --> 00:08:22,660
if I wanted to go into colors I can just see the colors or CDC and hit tab and the auto completes for

109
00:08:22,650 --> 00:08:23,370
me.

110
00:08:23,880 --> 00:08:29,430
So it is a little faster than it might seem upfront and once you master this once you get comfortable

111
00:08:29,440 --> 00:08:32,470
with the commands you can do them very quickly.

112
00:08:32,470 --> 00:08:37,560
I know you may not believe me right now because it's definitely slower especially the pace that we're

113
00:08:37,570 --> 00:08:42,480
going at but when you start out it always feels slower and it always is slower.

114
00:08:42,490 --> 00:08:47,550
My students always complain without fail in the first few weeks that the command line is never going

115
00:08:47,560 --> 00:08:48,780
to be useful for them.

116
00:08:48,820 --> 00:08:50,620
It will never become second nature.

117
00:08:50,910 --> 00:08:55,400
And then after using it for a few weeks it really clicks and they never go back.

118
00:08:55,440 --> 00:09:00,930
Even the people who felt the strongest about not using it after I had forced them to use it and I did

119
00:09:00,930 --> 00:09:05,600
some exercises and they saw everyone else using it just after a few weeks.

120
00:09:05,670 --> 00:09:07,080
Everyone's a convert.

121
00:09:07,600 --> 00:09:12,810
There's one thing I didn't show which is that you can also do ls on a folder that you're not inside

122
00:09:12,820 --> 00:09:13,600
of.

123
00:09:13,600 --> 00:09:18,940
So I'm currently inside of Intro to command line if I wanted to see what's inside of colors I can type

124
00:09:18,940 --> 00:09:18,970
.

125
00:09:18,980 --> 00:09:24,990
LS colors and it shows me that red dot TXI t is instead of colors.

126
00:09:25,360 --> 00:09:33,400
And then there's CD change directory and I can do cd space and the name of a directory like colors and

127
00:09:33,390 --> 00:09:38,440
you can see my prompt changes and if I type LS here I get red dot T.

128
00:09:38,860 --> 00:09:43,080
And I can do C.D. dot dot to go back one level.

129
00:09:43,090 --> 00:09:46,930
So now I'm on intro to command line one more time.

130
00:09:46,920 --> 00:09:52,290
And now I'm on workspace and the next video we're going to see how we can create files and directories

131
00:09:52,330 --> 00:09:58,590
from the command line rather than having to right click over here and click on new folder or a new file

132
00:09:58,660 --> 00:10:00,520
will do it from the command line.
