1
00:00:00,270 --> 00:00:01,830
In this video, we're going to talk

2
00:00:01,830 --> 00:00:03,660
about how Linux applies a simple

3
00:00:03,660 --> 00:00:06,030
and modular design philosophy through the use

4
00:00:06,030 --> 00:00:08,760
of the command line interface and the shell.

5
00:00:08,760 --> 00:00:10,950
Now, the Linux operating system emphasizes

6
00:00:10,950 --> 00:00:13,680
a simple user interface in which the user types

7
00:00:13,680 --> 00:00:15,450
in text commands into a prompt,

8
00:00:15,450 --> 00:00:17,910
and that way they can interact with the system.

9
00:00:17,910 --> 00:00:20,400
This differs from the primary visual operating systems,

10
00:00:20,400 --> 00:00:23,970
like Windows and macOS, which use a graphical user interface

11
00:00:23,970 --> 00:00:26,820
or G-U-I, known as a GUI.

12
00:00:26,820 --> 00:00:28,110
In Linux administration,

13
00:00:28,110 --> 00:00:30,480
one of the most crucial skills is becoming comfortable

14
00:00:30,480 --> 00:00:33,510
at entering text commands using the command line interface,

15
00:00:33,510 --> 00:00:35,880
also known as the CLI.

16
00:00:35,880 --> 00:00:38,370
Now, the CLI is a text-based interface

17
00:00:38,370 --> 00:00:40,530
between the user and the operating system

18
00:00:40,530 --> 00:00:43,350
that accepts input in the form of typed commands.

19
00:00:43,350 --> 00:00:45,420
A command prompt is presented to the user,

20
00:00:45,420 --> 00:00:47,040
and the user enters a command to interact

21
00:00:47,040 --> 00:00:49,800
with the system in a variety of different ways.

22
00:00:49,800 --> 00:00:51,570
Developers and administrators often use

23
00:00:51,570 --> 00:00:52,920
the command line interface,

24
00:00:52,920 --> 00:00:54,900
whereas regular users will like to rely

25
00:00:54,900 --> 00:00:57,960
on a graphical user interface, or GUI, instead.

26
00:00:57,960 --> 00:01:00,420
Many distributions though, especially the ones used

27
00:01:00,420 --> 00:01:03,600
for servers, do not come with a graphical user interface,

28
00:01:03,600 --> 00:01:04,800
but there are many different GUIs

29
00:01:04,800 --> 00:01:06,270
that are developed that can be installed

30
00:01:06,270 --> 00:01:08,700
on top of Linux after the fact too.

31
00:01:08,700 --> 00:01:11,490
So throughout this course, we're going to focus primarily

32
00:01:11,490 --> 00:01:13,470
on using the command line interface

33
00:01:13,470 --> 00:01:15,090
because as a system administrator,

34
00:01:15,090 --> 00:01:17,940
this is where you're going to spend a lot of your time.

35
00:01:17,940 --> 00:01:20,100
Now, in addition to the command line interface,

36
00:01:20,100 --> 00:01:22,440
we have something known as the shell.

37
00:01:22,440 --> 00:01:24,300
Now, a shell contains the core portion

38
00:01:24,300 --> 00:01:26,970
of the operating system, referred to as the kernel,

39
00:01:26,970 --> 00:01:28,710
and it permits the user to pass commands

40
00:01:28,710 --> 00:01:30,960
and information to that kernel.

41
00:01:30,960 --> 00:01:33,000
The kernel is also able to respond back

42
00:01:33,000 --> 00:01:35,100
to the user through that shell.

43
00:01:35,100 --> 00:01:37,050
The shell can be thought of as an interpreter

44
00:01:37,050 --> 00:01:40,290
between the humans and the kernel of the operating system.

45
00:01:40,290 --> 00:01:42,750
Linux users are going to issue commands to the shell

46
00:01:42,750 --> 00:01:44,130
in order to tell the operating system

47
00:01:44,130 --> 00:01:45,720
what they want it to do.

48
00:01:45,720 --> 00:01:47,730
The operating system will then respond back

49
00:01:47,730 --> 00:01:50,610
to the user with the results of the command.

50
00:01:50,610 --> 00:01:52,020
A shell can be implemented as either

51
00:01:52,020 --> 00:01:55,830
a command line interface or a graphical user interface.

52
00:01:55,830 --> 00:01:57,330
Like most things in Linux,

53
00:01:57,330 --> 00:01:59,550
you can actually choose which shell you want to use

54
00:01:59,550 --> 00:02:01,770
within your command line interface too.

55
00:02:01,770 --> 00:02:03,810
For this course and the exam,

56
00:02:03,810 --> 00:02:06,240
we're going to focus on the Bash shell.

57
00:02:06,240 --> 00:02:10,020
The original Unix shell was called the Bourne shell or SH.

58
00:02:10,020 --> 00:02:12,420
Although it's still available on some Linux systems,

59
00:02:12,420 --> 00:02:13,800
it has been virtually replaced

60
00:02:13,800 --> 00:02:16,320
on most systems by the Bourne-again shell

61
00:02:16,320 --> 00:02:19,470
or B-A-S-H, known as bash.

62
00:02:19,470 --> 00:02:21,630
Virtually every Linux distribution will use

63
00:02:21,630 --> 00:02:23,160
this shell as the translator

64
00:02:23,160 --> 00:02:25,860
between the user and the system by default.

65
00:02:25,860 --> 00:02:28,110
Now, it is possible to install and use other shells

66
00:02:28,110 --> 00:02:30,900
in Linux though, if you want to, things like Korn,

67
00:02:30,900 --> 00:02:34,710
the Z shell and the TC shell are all popular as well.

68
00:02:34,710 --> 00:02:37,020
Now, when you're using a shell, you need to make sure

69
00:02:37,020 --> 00:02:39,750
you're using the proper syntax for that shell.

70
00:02:39,750 --> 00:02:42,270
Syntax is the proper way of structuring a command

71
00:02:42,270 --> 00:02:44,310
and any supporting information.

72
00:02:44,310 --> 00:02:47,070
For example, in English, we all understand that

73
00:02:47,070 --> 00:02:49,860
when I make a statement like, "I want some water,"

74
00:02:49,860 --> 00:02:51,840
I am using the subject I.

75
00:02:51,840 --> 00:02:55,290
I'm using a verb, what, and an object, water,

76
00:02:55,290 --> 00:02:57,390
but if I was speaking a different language,

77
00:02:57,390 --> 00:02:59,700
the syntax here might change.

78
00:02:59,700 --> 00:03:02,220
For example, Yoda from Star Wars likes

79
00:03:02,220 --> 00:03:04,560
to follow a more Japanese style of syntax,

80
00:03:04,560 --> 00:03:07,620
and he says, "water, I want," which is object,

81
00:03:07,620 --> 00:03:09,840
then subject, then verb.

82
00:03:09,840 --> 00:03:11,940
Now, either of these isn't right or wrong,

83
00:03:11,940 --> 00:03:15,090
but it's right or wrong based on the syntax being used.

84
00:03:15,090 --> 00:03:17,610
So Yoda uses a different syntax

85
00:03:17,610 --> 00:03:19,890
than we do in the English language.

86
00:03:19,890 --> 00:03:22,770
Now, many command line interfaces have their own unique ways

87
00:03:22,770 --> 00:03:26,130
of entering in information or having a different syntax.

88
00:03:26,130 --> 00:03:27,990
It's important for you to understand the syntax

89
00:03:27,990 --> 00:03:29,610
for the shell you're going to be using.

90
00:03:29,610 --> 00:03:31,020
Otherwise, you're not going to be able

91
00:03:31,020 --> 00:03:33,690
to effectively communicate with that interface.

92
00:03:33,690 --> 00:03:36,960
Again, in this course, we're going to be focusing solely

93
00:03:36,960 --> 00:03:39,120
on the Bash shell syntax.

94
00:03:39,120 --> 00:03:42,660
Now, the Bash shell syntax contains three main components.

95
00:03:42,660 --> 00:03:45,780
We have the command, the options to modify the command

96
00:03:45,780 --> 00:03:48,180
and an argument for the command to act upon.

97
00:03:48,180 --> 00:03:50,640
It's important to take note here that there are spaces

98
00:03:50,640 --> 00:03:53,040
in between each of these three components.

99
00:03:53,040 --> 00:03:55,590
Also, at this point, it's really important

100
00:03:55,590 --> 00:03:57,150
to remember that the commands entered

101
00:03:57,150 --> 00:03:59,640
in Bash are going to be case-sensitive.

102
00:03:59,640 --> 00:04:03,270
So if I wanted to create a copy of a text file named Jason,

103
00:04:03,270 --> 00:04:05,280
and I wanted to make it called Dion,

104
00:04:05,280 --> 00:04:10,280
I could use the command cp -i Jason.txt Dion.txt.

105
00:04:11,940 --> 00:04:14,220
Now, what I just told the command here to do is

106
00:04:14,220 --> 00:04:16,560
to use the copy command or CP,

107
00:04:16,560 --> 00:04:20,220
and I want to do that using the modifier option of -I.

108
00:04:20,220 --> 00:04:23,970
This tells the shell to warn me before overriding a file,

109
00:04:23,970 --> 00:04:27,180
then I'm going to perform the action on the two arguments,

110
00:04:27,180 --> 00:04:30,600
the input file, Jason.txt and the newly created

111
00:04:30,600 --> 00:04:33,390
output file, Dion.txt.

112
00:04:33,390 --> 00:04:36,270
Now, if you fail to enter a command in the proper syntax,

113
00:04:36,270 --> 00:04:38,250
Bash will return an error to you.

114
00:04:38,250 --> 00:04:41,250
Typically, these error messages are very descriptive

115
00:04:41,250 --> 00:04:44,130
and will help you understand what Bash expects from you.

116
00:04:44,130 --> 00:04:46,050
For "command not found" errors,

117
00:04:46,050 --> 00:04:48,000
this simply means the shell doesn't understand

118
00:04:48,000 --> 00:04:49,920
the command you've asked it to do.

119
00:04:49,920 --> 00:04:53,250
For example, if I type CPT instead of CP,

120
00:04:53,250 --> 00:04:55,560
that's not a command it understands.

121
00:04:55,560 --> 00:04:58,350
Usually, this occurs whenever you misspell something.

122
00:04:58,350 --> 00:05:00,390
So always check your commands for typos

123
00:05:00,390 --> 00:05:02,190
if you're getting one of these errors.

124
00:05:02,190 --> 00:05:05,490
If you get an error like "no such file or directory" errors,

125
00:05:05,490 --> 00:05:06,750
this means you need to check

126
00:05:06,750 --> 00:05:09,780
for typos in the directory, file or path names.

127
00:05:09,780 --> 00:05:13,290
In my example, the Jason or the Dion files.

128
00:05:13,290 --> 00:05:15,570
Now, we're going to cover specific commands much more

129
00:05:15,570 --> 00:05:16,980
in depth throughout this course,

130
00:05:16,980 --> 00:05:18,840
but for now we just need to understand

131
00:05:18,840 --> 00:05:20,880
that the command line interface is a place

132
00:05:20,880 --> 00:05:22,800
for us to interact directly with the shell,

133
00:05:22,800 --> 00:05:25,110
and the shell requires us to use specific syntax

134
00:05:25,110 --> 00:05:26,880
when we do that, so it can understand

135
00:05:26,880 --> 00:05:28,880
the commands we're asking it to perform.

