WEBVTT

1
00:00:00.080 --> 00:00:02.640
<v Speaker 1>The Linux command line. You know, for a lot of people,

2
00:00:02.680 --> 00:00:06.480
<v Speaker 1>it's this incredibly powerful, but yeah, often intimidating gateway to

3
00:00:06.559 --> 00:00:09.400
<v Speaker 1>controlling your system. You just stare at that blinking cursor

4
00:00:09.800 --> 00:00:11.560
<v Speaker 1>and it feels a bit like a secret language you

5
00:00:11.560 --> 00:00:13.800
<v Speaker 1>haven't quite cracked yet. But what if I told you

6
00:00:13.839 --> 00:00:16.679
<v Speaker 1>that behind that initial, maybe slightly cryptic look lies some

7
00:00:16.719 --> 00:00:19.960
<v Speaker 1>of the most elegant, flexible, and actually kind of fun

8
00:00:20.079 --> 00:00:24.039
<v Speaker 1>aspects of Linux administration. Today we're doing a deep dive

9
00:00:24.280 --> 00:00:26.839
<v Speaker 1>right into the heart of Linux the command line. We're

10
00:00:26.839 --> 00:00:29.920
<v Speaker 1>going way beyond just you know, typing basic commands. We

11
00:00:29.960 --> 00:00:32.399
<v Speaker 1>want to uncover those hidden gems and clever tricks that

12
00:00:32.479 --> 00:00:35.520
<v Speaker 1>really transform it from just an interface into well, your

13
00:00:35.520 --> 00:00:38.000
<v Speaker 1>most powerful ally. Our mission here is to give you

14
00:00:38.000 --> 00:00:40.840
<v Speaker 1>a shortcut sort of to being truly well informed about

15
00:00:40.880 --> 00:00:42.960
<v Speaker 1>how to wield this amazing tool.

16
00:00:43.159 --> 00:00:45.039
<v Speaker 2>And we've got a great guide for this. We're drawing

17
00:00:45.039 --> 00:00:49.320
<v Speaker 2>from excerpts from the LPIC one Linux Professional Institute Certification

18
00:00:49.399 --> 00:00:54.359
<v Speaker 2>Study Guide. Uh. Now, this material it's designed specifically to

19
00:00:54.399 --> 00:00:59.799
<v Speaker 2>help you install, operate, troubleshoot Linux systems. It's absolutely packed

20
00:00:59.799 --> 00:01:02.240
<v Speaker 2>with the foundational knowledge. It's the kind of stuff that

21
00:01:02.280 --> 00:01:06.120
<v Speaker 2>turns those symbols that might seem cryptic at first into clear,

22
00:01:06.519 --> 00:01:09.560
<v Speaker 2>actionable insights. He gives you not just the what, but

23
00:01:09.640 --> 00:01:10.120
<v Speaker 2>the why.

24
00:01:10.560 --> 00:01:14.079
<v Speaker 1>So get ready for some serious aha moments, because we're

25
00:01:14.079 --> 00:01:17.400
<v Speaker 1>going to try and demystify what might seem overwhelming. We

26
00:01:17.480 --> 00:01:21.640
<v Speaker 1>want to equip you with practical skills that genuinely stick. Okay,

27
00:01:21.799 --> 00:01:23.799
<v Speaker 1>let's unpack this. So when I first started messing around

28
00:01:23.840 --> 00:01:26.519
<v Speaker 1>the lenox, I was just typing commands, you know, into

29
00:01:26.560 --> 00:01:29.200
<v Speaker 1>that black screen. I'd hear terms like bash or shell,

30
00:01:29.560 --> 00:01:31.879
<v Speaker 1>but honestly, it all just kind of blurred together. What

31
00:01:32.079 --> 00:01:34.359
<v Speaker 1>is a shell really at its core? And why do

32
00:01:34.400 --> 00:01:36.079
<v Speaker 1>we even have different ones? Is it just like a

33
00:01:36.120 --> 00:01:38.079
<v Speaker 1>different look or something more fundamental.

34
00:01:38.200 --> 00:01:41.439
<v Speaker 2>That's a really good question, because understanding the shell is fundamental.

35
00:01:41.840 --> 00:01:45.680
<v Speaker 2>At its core, a shell is an interactive utility. Think

36
00:01:45.719 --> 00:01:48.040
<v Speaker 2>of it as your direct interpreter for the system.

37
00:01:48.120 --> 00:01:49.040
<v Speaker 1>Ah, the interpreter.

38
00:01:49.159 --> 00:01:51.799
<v Speaker 2>Okay, yeah, let's you run programs, manage your files, supervis

39
00:01:51.879 --> 00:01:55.519
<v Speaker 2>process all that just through text based commands. It's not

40
00:01:55.640 --> 00:01:58.879
<v Speaker 2>just the window, it's the environment itself, and the most

41
00:01:58.920 --> 00:02:01.959
<v Speaker 2>common one, the default for most Linux user accounts, the

42
00:02:02.000 --> 00:02:05.480
<v Speaker 2>one you've probably bumped into, is the gene you born Againshell.

43
00:02:05.359 --> 00:02:08.000
<v Speaker 1>Bash Bash, right, I hear that all the time.

44
00:02:08.240 --> 00:02:12.080
<v Speaker 2>Exactly came out in nineteen eighty nine. But you're right.

45
00:02:12.120 --> 00:02:15.479
<v Speaker 2>There are others like Dash, for example, the Debian Olmquish shell.

46
00:02:15.599 --> 00:02:16.439
<v Speaker 2>It's smaller, it's.

47
00:02:16.360 --> 00:02:18.000
<v Speaker 1>Faster, smaller and faster.

48
00:02:18.319 --> 00:02:21.879
<v Speaker 2>Why well, it's often preferred for running scripts behind the

49
00:02:21.879 --> 00:02:26.000
<v Speaker 2>scenes because it's more efficient. You know, fewer interactive features

50
00:02:26.039 --> 00:02:28.879
<v Speaker 2>like fancy command line editing, but it gets the job

51
00:02:28.919 --> 00:02:30.080
<v Speaker 2>done quickly for automation.

52
00:02:30.360 --> 00:02:32.479
<v Speaker 1>Okay, so optimize for scripting. What else?

53
00:02:32.680 --> 00:02:35.800
<v Speaker 2>Then there's the Z shell zish. That one combines features

54
00:02:35.840 --> 00:02:38.840
<v Speaker 2>from Bash and others. It offers more advanced scripting, shared

55
00:02:38.879 --> 00:02:41.960
<v Speaker 2>history across sessions which is cool, and even highly customizable

56
00:02:42.000 --> 00:02:45.360
<v Speaker 2>theme proNTs. Lots of people really like z for interactive use.

57
00:02:45.639 --> 00:02:47.919
<v Speaker 1>So it really is like having different ways to talk

58
00:02:47.960 --> 00:02:49.759
<v Speaker 1>to your computer depending on what you need to do.

59
00:02:50.960 --> 00:02:53.919
<v Speaker 1>That makes sense. I also saw in the Sork material

60
00:02:53.960 --> 00:02:56.719
<v Speaker 1>a mention of binch. How does that fit in with

61
00:02:56.840 --> 00:02:59.840
<v Speaker 1>Bash and Dash and ziz ah binch.

62
00:03:00.159 --> 00:03:02.960
<v Speaker 2>Yeah, that's interesting because it touches on history and compatibility.

63
00:03:04.159 --> 00:03:08.639
<v Speaker 2>Historically on Unix systems, binch was the standard path for

64
00:03:08.719 --> 00:03:09.520
<v Speaker 2>the system shell.

65
00:03:09.719 --> 00:03:11.120
<v Speaker 1>The original one kind of.

66
00:03:11.319 --> 00:03:14.199
<v Speaker 2>Sort of yeah, but on modern Linux systems it's usually

67
00:03:14.240 --> 00:03:17.199
<v Speaker 2>just a symbolic link. It often points to BASH or

68
00:03:17.240 --> 00:03:20.599
<v Speaker 2>sometimes Dash, depending on the distribution's choice. You can actually

69
00:03:20.680 --> 00:03:22.960
<v Speaker 2>check it yourself with the read link command. Just type

70
00:03:23.080 --> 00:03:23.840
<v Speaker 2>read link binch.

71
00:03:24.000 --> 00:03:24.280
<v Speaker 1>Oh me.

72
00:03:24.599 --> 00:03:26.599
<v Speaker 2>Yeah, it's a subtle thing, but it shows how Linux

73
00:03:26.639 --> 00:03:29.520
<v Speaker 2>evolve while making sure older scripts that expect binch to

74
00:03:29.520 --> 00:03:30.599
<v Speaker 2>be there still were fun.

75
00:03:30.800 --> 00:03:34.280
<v Speaker 1>Okay, that idea of different conversational styles, it's really clicking.

76
00:03:34.439 --> 00:03:36.319
<v Speaker 1>But even if you pick the right style, sometimes you

77
00:03:36.360 --> 00:03:38.960
<v Speaker 1>just need help figuring out what to say right. There

78
00:03:38.960 --> 00:03:41.319
<v Speaker 1>are so many commands, so many options.

79
00:03:41.479 --> 00:03:44.560
<v Speaker 2>Oh absolutely, and for that, the venerable MAN pages are

80
00:03:44.599 --> 00:03:45.840
<v Speaker 2>your absolute best friends.

81
00:03:45.960 --> 00:03:48.680
<v Speaker 1>Seriously, Man for manual, Yeah exactly.

82
00:03:48.919 --> 00:03:51.520
<v Speaker 2>The man command is your primary help desk, and it's

83
00:03:51.520 --> 00:03:54.759
<v Speaker 2>incredibly comprehensive. You can look up the manual page for

84
00:03:54.759 --> 00:03:58.599
<v Speaker 2>a command like password, for instance, man password. But here's

85
00:03:58.639 --> 00:04:01.919
<v Speaker 2>a key thing about Linux design. The same name can

86
00:04:01.960 --> 00:04:03.120
<v Speaker 2>mean different things.

87
00:04:03.080 --> 00:04:05.520
<v Speaker 1>Like the password command versus the password.

88
00:04:05.039 --> 00:04:08.400
<v Speaker 2>File precisely, so, password could be the command to change

89
00:04:08.400 --> 00:04:11.280
<v Speaker 2>your password, or it could refer to the it's set

90
00:04:11.280 --> 00:04:15.000
<v Speaker 2>of password file where user info is stored. So to

91
00:04:15.039 --> 00:04:17.839
<v Speaker 2>see the documentation specifically for the file. You'd specify the

92
00:04:17.839 --> 00:04:21.360
<v Speaker 2>section number you type, Man five password section five. Yeah,

93
00:04:21.360 --> 00:04:23.360
<v Speaker 2>the five foot tells Man to look in section five

94
00:04:23.360 --> 00:04:26.319
<v Speaker 2>of the manual, which covers file formats and conventions. It

95
00:04:26.319 --> 00:04:30.480
<v Speaker 2>turns that potential confusion into really precise information seeking.

96
00:04:30.720 --> 00:04:32.959
<v Speaker 1>That's brilliant. So it's not just a command list, it's

97
00:04:32.959 --> 00:04:36.480
<v Speaker 1>like a whole system library organized. What if Man says

98
00:04:36.600 --> 00:04:38.240
<v Speaker 1>nothing appropriate found, does that happen?

99
00:04:38.360 --> 00:04:41.160
<v Speaker 2>It does? Sometimes. Usually it's one of two things. First,

100
00:04:41.360 --> 00:04:44.199
<v Speaker 2>maybe just a typo. The command line is super picky

101
00:04:44.240 --> 00:04:44.759
<v Speaker 2>about spelling.

102
00:04:44.800 --> 00:04:46.920
<v Speaker 1>Guilty is charged there sometimes we all are.

103
00:04:47.600 --> 00:04:50.600
<v Speaker 2>Second, it could be that the man utilities database its

104
00:04:50.639 --> 00:04:54.720
<v Speaker 2>index needs updating. On older systems, you might run make whatdies.

105
00:04:55.279 --> 00:04:58.360
<v Speaker 2>On more modern ones, it's typically manned Y usually need

106
00:04:58.439 --> 00:05:03.079
<v Speaker 2>super user privileges like pseudomand y to rebuild that index, like.

107
00:05:03.120 --> 00:05:05.160
<v Speaker 1>Rebuilding the library's card catalog.

108
00:05:05.399 --> 00:05:06.319
<v Speaker 2>Got it okay?

109
00:05:06.360 --> 00:05:09.160
<v Speaker 1>And what about those moments We've all had them where

110
00:05:09.199 --> 00:05:12.079
<v Speaker 1>you just ran a command maybe five minutes ago, maybe yesterday,

111
00:05:12.439 --> 00:05:15.720
<v Speaker 1>and it was long and complicated and you really really

112
00:05:15.800 --> 00:05:17.079
<v Speaker 1>don't want to type it all out again.

113
00:05:17.120 --> 00:05:20.959
<v Speaker 2>Oh yeah, that's where your command line history is just invaluable.

114
00:05:21.319 --> 00:05:24.319
<v Speaker 2>The shell remembers what you've typed. It's a huge timesaver.

115
00:05:24.480 --> 00:05:25.399
<v Speaker 1>How do you access it?

116
00:05:25.560 --> 00:05:27.920
<v Speaker 2>Just type history you'll get a numbered list of your

117
00:05:28.000 --> 00:05:28.800
<v Speaker 2>racing command.

118
00:05:28.639 --> 00:05:30.759
<v Speaker 1>Okay, a list, but rerunning them.

119
00:05:30.920 --> 00:05:34.240
<v Speaker 2>Ah, here's the pro tip that seriously speeds things up. Yeah,

120
00:05:34.360 --> 00:05:36.839
<v Speaker 2>you can re execute any command from that list just

121
00:05:36.920 --> 00:05:39.120
<v Speaker 2>by typing do followed by its history number.

122
00:05:39.240 --> 00:05:42.480
<v Speaker 1>Seriously, like point nine two zero or something exactly.

123
00:05:42.759 --> 00:05:45.839
<v Speaker 2>Type point nine two zero, hit enter. The shell shows

124
00:05:45.839 --> 00:05:47.639
<v Speaker 2>you the command it found at number nine twenty, and

125
00:05:47.639 --> 00:05:52.120
<v Speaker 2>then runs it immediately. Yeah. It's fantastic for repeating complex

126
00:05:52.120 --> 00:05:54.639
<v Speaker 2>commands or even just fixing a small typo in the

127
00:05:54.639 --> 00:05:57.839
<v Speaker 2>previous one without retyping everything. A genuine timesaver.

128
00:05:58.199 --> 00:06:00.399
<v Speaker 1>Okay, this is where the command line starts to feel

129
00:06:00.480 --> 00:06:02.639
<v Speaker 1>less like just typing orders and more like I don't

130
00:06:02.639 --> 00:06:06.199
<v Speaker 1>know a specialized language. Once you get past the basic commands,

131
00:06:06.279 --> 00:06:09.279
<v Speaker 1>I often wonder what that next layer is. It feels

132
00:06:09.279 --> 00:06:11.519
<v Speaker 1>like the shell must have its own grammar, its own

133
00:06:12.519 --> 00:06:14.879
<v Speaker 1>secret code beyond simple words.

134
00:06:15.040 --> 00:06:17.040
<v Speaker 2>You're absolutely right that secret code is made up of

135
00:06:17.079 --> 00:06:17.839
<v Speaker 2>meta characters.

136
00:06:17.879 --> 00:06:19.240
<v Speaker 1>Meta characters, Yeah, these are.

137
00:06:19.240 --> 00:06:22.079
<v Speaker 2>Characters that have special meanings, special functions within the bash

138
00:06:22.120 --> 00:06:25.439
<v Speaker 2>shell itself. They are incredibly powerful because they let you

139
00:06:25.480 --> 00:06:30.000
<v Speaker 2>do things like match patterns, perform complex operations, manipulate whole

140
00:06:30.000 --> 00:06:32.399
<v Speaker 2>groups of files with just a few keystrokes, like the

141
00:06:32.439 --> 00:06:35.800
<v Speaker 2>asterisk the star exactly, the ass risk is a wildcard

142
00:06:35.920 --> 00:06:38.680
<v Speaker 2>it matches any number of characters, or the question mark

143
00:06:38.759 --> 00:06:41.920
<v Speaker 2>that matches just a single character. We also have bracketed

144
00:06:41.920 --> 00:06:43.279
<v Speaker 2>wild cards like.

145
00:06:43.600 --> 00:06:48.319
<v Speaker 1>Bayo okay, bayo that would match bet bit or bot precisely.

146
00:06:48.680 --> 00:06:51.959
<v Speaker 2>And a really clever one is the carry symbol inside brackets.

147
00:06:52.319 --> 00:06:57.680
<v Speaker 2>It negates the selection negats, so BeO would match bat

148
00:06:57.800 --> 00:07:01.439
<v Speaker 2>or butt, but not bet bit or bought. It matches

149
00:07:01.519 --> 00:07:04.560
<v Speaker 2>anything except what's in the brackets after the character.

150
00:07:04.600 --> 00:07:08.439
<v Speaker 1>Oh okay. That's subtle but powerful. It turns a simple

151
00:07:08.439 --> 00:07:12.000
<v Speaker 1>command like ULLs into this pattern matching engine for your files.

152
00:07:12.279 --> 00:07:16.240
<v Speaker 1>You're not just listing your searching, filtering, tidying up logs,

153
00:07:16.560 --> 00:07:19.800
<v Speaker 1>finding specific and fig files quickly. But what happens if

154
00:07:19.839 --> 00:07:22.279
<v Speaker 1>you actually want to use one of those special characters

155
00:07:22.319 --> 00:07:24.959
<v Speaker 1>like an asterisk or a question mark literally like in

156
00:07:24.959 --> 00:07:26.240
<v Speaker 1>a file name or a message.

157
00:07:26.240 --> 00:07:29.279
<v Speaker 2>Ah. Yes, that's where shell quoting comes in. And it's

158
00:07:29.319 --> 00:07:31.879
<v Speaker 2>not just cosmetic, it's the fundamental control mechanism.

159
00:07:31.920 --> 00:07:32.720
<v Speaker 1>Cotrol mechanism.

160
00:07:32.839 --> 00:07:36.000
<v Speaker 2>Yeah, because without the right quoting, the shell might interpret

161
00:07:36.040 --> 00:07:38.920
<v Speaker 2>those special characters in ways you didn't intend. It could

162
00:07:38.959 --> 00:07:40.680
<v Speaker 2>mess up your command or worse.

163
00:07:41.040 --> 00:07:42.600
<v Speaker 1>Okay, so how do we quote?

164
00:07:42.879 --> 00:07:45.800
<v Speaker 2>Your two best friends are single quotes and double quotes?

165
00:07:45.839 --> 00:07:47.480
<v Speaker 1>Single quotes and double clothes. What's the difference.

166
00:07:47.759 --> 00:07:52.560
<v Speaker 2>It's crucial. Single quotes preserve the literal value of every

167
00:07:52.600 --> 00:07:56.240
<v Speaker 2>single character inside them, no exceptions. If you type echo

168
00:07:56.360 --> 00:07:59.600
<v Speaker 2>what's the deal, you will get exactly what's the deal.

169
00:07:59.720 --> 00:08:01.959
<v Speaker 2>The asterisk is just an asterisk.

170
00:08:01.959 --> 00:08:05.759
<v Speaker 1>Okay, literal lockdown with single quotes? What about double.

171
00:08:05.600 --> 00:08:08.920
<v Speaker 2>Double quotes are slightly different. They preserve the literal value

172
00:08:08.959 --> 00:08:11.439
<v Speaker 2>of most characters, but they still allow a few special

173
00:08:11.480 --> 00:08:15.079
<v Speaker 2>things to happen inside like what like variable substitution using

174
00:08:15.120 --> 00:08:16.959
<v Speaker 2>VASR and command substitution.

175
00:08:17.160 --> 00:08:20.920
<v Speaker 1>Ah. So if I have a variable, say MYVR awesome,

176
00:08:21.079 --> 00:08:23.920
<v Speaker 1>and I type echo this is MYVAR, it will.

177
00:08:23.759 --> 00:08:27.680
<v Speaker 2>Actually output this is awesome. The shell substitutes the variables value.

178
00:08:27.720 --> 00:08:30.600
<v Speaker 2>If you use single quotes, echo this is nyvar, you

179
00:08:30.720 --> 00:08:32.320
<v Speaker 2>just get this is MYVR.

180
00:08:32.440 --> 00:08:37.360
<v Speaker 1>Gotcha. Subtle but super important for writing commands correctly, especially scripts. Okay,

181
00:08:37.399 --> 00:08:40.600
<v Speaker 1>that clarifies it perfectly. So once you're comfortable with the shell,

182
00:08:40.639 --> 00:08:44.240
<v Speaker 1>it's language, the quoting. A massive part of Linux admin

183
00:08:44.320 --> 00:08:48.240
<v Speaker 1>is dealing with text files right logs, configs, data. You

184
00:08:48.360 --> 00:08:50.519
<v Speaker 1>must need a specific set of tools just for chewing

185
00:08:50.519 --> 00:08:51.639
<v Speaker 1>through all that text quickly.

186
00:08:51.840 --> 00:08:55.159
<v Speaker 2>Absolutely, it's a core skill, and thankfully Linux gives us

187
00:08:55.200 --> 00:08:58.159
<v Speaker 2>this incredibly rich tool belt just for that. For just

188
00:08:58.240 --> 00:09:02.080
<v Speaker 2>viewing files, the classic is CAT cat file name. It

189
00:09:02.200 --> 00:09:03.919
<v Speaker 2>just dumps the whole file to your screen.

190
00:09:04.080 --> 00:09:08.200
<v Speaker 1>Simple effective for a quick look. Yep, straightforward, and didn't

191
00:09:08.240 --> 00:09:11.360
<v Speaker 1>the source mention BAT Like CAT with wings it did,

192
00:09:11.840 --> 00:09:12.240
<v Speaker 1>BAT is.

193
00:09:12.200 --> 00:09:15.559
<v Speaker 2>A more modern clone. It adds nice things like syntax highlighting,

194
00:09:15.759 --> 00:09:20.200
<v Speaker 2>get integration makes looking at code, couldfig files much prettier,

195
00:09:20.480 --> 00:09:21.559
<v Speaker 2>much easier to read.

196
00:09:21.840 --> 00:09:25.039
<v Speaker 1>Nice. But what if you suspect weird and visible characters

197
00:09:25.080 --> 00:09:25.960
<v Speaker 1>are messing things up?

198
00:09:26.200 --> 00:09:30.000
<v Speaker 2>Good point for that. CAT has options like magia or

199
00:09:30.039 --> 00:09:33.759
<v Speaker 2>adjuge that can help reveal non printing characters. And for

200
00:09:33.799 --> 00:09:36.399
<v Speaker 2>an even deeper dive, there's the ODD command stands for

201
00:09:36.440 --> 00:09:37.120
<v Speaker 2>octal dump.

202
00:09:37.200 --> 00:09:37.960
<v Speaker 1>Octal dump.

203
00:09:38.080 --> 00:09:41.159
<v Speaker 2>Yeah, it displays the files content in AKL or other formats.

204
00:09:41.399 --> 00:09:44.919
<v Speaker 2>It's invaluable for finding those really sneaky non printing characters

205
00:09:44.919 --> 00:09:47.159
<v Speaker 2>that might be causing weird issues. That a normal text

206
00:09:47.279 --> 00:09:48.279
<v Speaker 2>editor just won't show you.

207
00:09:48.360 --> 00:09:51.639
<v Speaker 1>Okay, useful for troubleshooting. What about huge files though, like

208
00:09:51.799 --> 00:09:55.080
<v Speaker 1>massive log files, CAT would just fly by exactly.

209
00:09:55.279 --> 00:09:58.159
<v Speaker 2>For big files you need pages. The old standby is

210
00:09:58.200 --> 00:09:58.840
<v Speaker 2>more more.

211
00:09:59.279 --> 00:10:01.679
<v Speaker 1>Let's you go four ford page by page with spacebar

212
00:10:01.799 --> 00:10:02.440
<v Speaker 1>right right.

213
00:10:02.360 --> 00:10:04.960
<v Speaker 2>Page by page with space, line by line with enter.

214
00:10:05.360 --> 00:10:08.360
<v Speaker 2>But the catch with more is you can't easily go backward.

215
00:10:08.480 --> 00:10:10.360
<v Speaker 1>Ah, so what's better less?

216
00:10:10.960 --> 00:10:13.519
<v Speaker 2>The command is less. It's the more powerful pager. In fact,

217
00:10:13.720 --> 00:10:16.720
<v Speaker 2>man pages use less by default behind the scenes.

218
00:10:16.440 --> 00:10:17.360
<v Speaker 1>Unless it is more.

219
00:10:17.559 --> 00:10:21.159
<v Speaker 2>Huh exactly Less lets you move forward and backward using

220
00:10:21.279 --> 00:10:24.360
<v Speaker 2>arrow keys page up, down, and crucially, it has powerful

221
00:10:24.440 --> 00:10:27.960
<v Speaker 2>search features built in to search forward, to search backward.

222
00:10:28.519 --> 00:10:30.720
<v Speaker 2>Much more versatile for digging through dense text.

223
00:10:31.000 --> 00:10:34.240
<v Speaker 1>Makes sense, so we can view files navigate big ones.

224
00:10:34.600 --> 00:10:36.440
<v Speaker 1>How do we start pulling out just the bits we

225
00:10:36.480 --> 00:10:37.879
<v Speaker 1>need or getting quick summaries.

226
00:10:38.120 --> 00:10:40.799
<v Speaker 2>Right for summaries or just peaking at the ends, we

227
00:10:40.919 --> 00:10:41.919
<v Speaker 2>have head and tail.

228
00:10:42.159 --> 00:10:43.840
<v Speaker 1>Head for the beginning, tail for the end.

229
00:10:43.960 --> 00:10:47.559
<v Speaker 2>Precisely. Head file name shows the first ten lines by default,

230
00:10:47.559 --> 00:10:50.200
<v Speaker 2>Tail file name shows the last ten. You can change

231
00:10:50.200 --> 00:10:52.440
<v Speaker 2>the number of lines with modd end and tail has

232
00:10:52.440 --> 00:10:53.679
<v Speaker 2>that killer feature tail.

233
00:10:53.519 --> 00:10:57.399
<v Speaker 1>Space follow mode for watching logs in real time.

234
00:10:57.559 --> 00:11:02.039
<v Speaker 2>Exactly tail dash F varlogslog or whatever. You see new

235
00:11:02.120 --> 00:11:05.000
<v Speaker 2>lines appear as they're written to the file. Absolute life

236
00:11:05.000 --> 00:11:08.279
<v Speaker 2>saver when troubleshooting live issues. You just watch that log

237
00:11:09.039 --> 00:11:09.879
<v Speaker 2>waiting for the air.

238
00:11:10.120 --> 00:11:12.240
<v Speaker 1>Been there? What about summaries like counts.

239
00:11:11.960 --> 00:11:16.600
<v Speaker 2>For counts, there's WC word count WC WC file name

240
00:11:16.840 --> 00:11:18.840
<v Speaker 2>gives you the number of lines, words and bytes in

241
00:11:18.879 --> 00:11:22.240
<v Speaker 2>the file. Super quick overview. And for pulling out specific

242
00:11:22.279 --> 00:11:26.840
<v Speaker 2>pieces of data from lines, especially structured data, cut is fantastic.

243
00:11:27.080 --> 00:11:27.799
<v Speaker 1>How does that work?

244
00:11:27.919 --> 00:11:30.440
<v Speaker 2>You tell it how the data is separated, like using

245
00:11:30.440 --> 00:11:33.039
<v Speaker 2>a comma or a tabs, a delimiter, and then which

246
00:11:33.080 --> 00:11:36.559
<v Speaker 2>field number you want ted crucial for parsing things like

247
00:11:36.639 --> 00:11:39.120
<v Speaker 2>CSV files or specific log formats.

248
00:11:39.159 --> 00:11:43.480
<v Speaker 1>Okay, headtail, WC cut pretty fundamental tools for slicing and

249
00:11:43.559 --> 00:11:47.960
<v Speaker 1>dicing text. What about finding specific patterns or sorting the

250
00:11:48.039 --> 00:11:50.080
<v Speaker 1>data that feels like something you'd need constantly?

251
00:11:50.200 --> 00:11:53.200
<v Speaker 2>Oh? Absolutely essential? And for searching the undisputed king.

252
00:11:53.120 --> 00:11:57.759
<v Speaker 1>Is grip grip global regular expression print right, that's the one.

253
00:11:57.840 --> 00:12:02.360
<v Speaker 2>It searches files for lines containing a pattern. Basic usagep

254
00:12:02.600 --> 00:12:07.399
<v Speaker 2>pattern file name like rep root et cetera. Pass finds

255
00:12:07.480 --> 00:12:10.879
<v Speaker 2>all lines with root in the password file. I remember

256
00:12:10.879 --> 00:12:14.399
<v Speaker 2>debugging the script once logs were going crazy. Rep was

257
00:12:14.399 --> 00:12:16.600
<v Speaker 2>the only way it could possibly sift through thousands of

258
00:12:16.679 --> 00:12:20.399
<v Speaker 2>lines to find the error messages I needed. It's incredibly versatile.

259
00:12:20.559 --> 00:12:23.559
<v Speaker 1>Can it do more than just find lines with a pattern?

260
00:12:23.759 --> 00:12:26.960
<v Speaker 2>Definitely? Use gp dash v to invert the match show

261
00:12:26.960 --> 00:12:29.200
<v Speaker 2>lines that do not contain the pattern. And you can

262
00:12:29.279 --> 00:12:32.320
<v Speaker 2>use regular expressions for much more precise matching, like matches

263
00:12:32.360 --> 00:12:34.679
<v Speaker 2>the start of a line matches the end ah.

264
00:12:34.720 --> 00:12:37.240
<v Speaker 1>So you could do something like grap dash v knowledge

265
00:12:37.240 --> 00:12:38.240
<v Speaker 1>and except for a pass.

266
00:12:38.080 --> 00:12:41.840
<v Speaker 2>Rate exactly, that would find user accounts whose lines don't

267
00:12:41.960 --> 00:12:44.759
<v Speaker 2>end with knowledge, in effectively accounts that can log in.

268
00:12:45.360 --> 00:12:47.519
<v Speaker 2>Super powerful for filtering and sorting.

269
00:12:47.600 --> 00:12:49.080
<v Speaker 1>If I g repped a bunch of lines, could I

270
00:12:49.120 --> 00:12:49.519
<v Speaker 1>sort them?

271
00:12:49.559 --> 00:12:52.840
<v Speaker 2>Yep? Using the sort command. By default, it sorts alphabetically.

272
00:12:52.919 --> 00:12:53.879
<v Speaker 1>What if they're numbers?

273
00:12:54.159 --> 00:12:57.200
<v Speaker 2>Use sort nash an for a numerical sort like sort

274
00:12:57.320 --> 00:13:00.879
<v Speaker 2>nash incounts dot txt and a hand trick with sort

275
00:13:00.919 --> 00:13:04.480
<v Speaker 2>is the ASHO option. Sort natcho output file dot txt,

276
00:13:05.159 --> 00:13:08.720
<v Speaker 2>input file dot txt. It sorts input file dot txt

277
00:13:09.080 --> 00:13:12.120
<v Speaker 2>and writes the result directly to output file dot txt

278
00:13:12.639 --> 00:13:13.120
<v Speaker 2>very clean.

279
00:13:13.320 --> 00:13:16.600
<v Speaker 1>Okay. These tools are clearly the building blocks for manipulating text.

280
00:13:16.679 --> 00:13:19.559
<v Speaker 1>But this next part, this feels like where the command

281
00:13:19.639 --> 00:13:22.320
<v Speaker 1>line transforms from just a toolbox into a whole workshop.

282
00:13:22.639 --> 00:13:24.720
<v Speaker 1>It's not just about what each command does, but how

283
00:13:24.759 --> 00:13:27.240
<v Speaker 1>they talk to each other, right, how they connect, That

284
00:13:27.320 --> 00:13:29.600
<v Speaker 1>seems key to making them more powerful together.

285
00:13:29.879 --> 00:13:32.159
<v Speaker 2>That is exactly where the true power lies. It happens

286
00:13:32.200 --> 00:13:35.600
<v Speaker 2>through streams, pipes, and redirection. See, every command usually works

287
00:13:35.639 --> 00:13:36.120
<v Speaker 2>with three.

288
00:13:35.919 --> 00:13:37.879
<v Speaker 1>Standard stream streams like streams of data.

289
00:13:37.919 --> 00:13:41.360
<v Speaker 2>Precisely, there's stda N standard input that's where a command

290
00:13:41.360 --> 00:13:43.519
<v Speaker 2>gets its input. Usually that's your ty board. Then sdd

291
00:13:43.639 --> 00:13:46.679
<v Speaker 2>OAE standard output where the command sends its normal results,

292
00:13:46.879 --> 00:13:50.279
<v Speaker 2>usually your screen, and sdd AIR standard air where air

293
00:13:50.279 --> 00:13:52.519
<v Speaker 2>messages go, also usually to your screen by.

294
00:13:52.360 --> 00:13:56.360
<v Speaker 1>Default s TVs TDDA s td air. Okay. So this

295
00:13:56.519 --> 00:13:59.200
<v Speaker 1>idea of redirection, it means we can change where those

296
00:13:59.200 --> 00:14:01.919
<v Speaker 1>streams go instead of the keyboorder screen exactly.

297
00:14:02.240 --> 00:14:04.799
<v Speaker 2>You can reroute them. The symbol redirects std o.

298
00:14:04.840 --> 00:14:07.399
<v Speaker 1>UT sends output to a file, yes.

299
00:14:07.480 --> 00:14:09.960
<v Speaker 2>But be careful overwrites a file if it exists.

300
00:14:10.080 --> 00:14:13.360
<v Speaker 1>Boof gone ouch Okay, caution needed. What if I want

301
00:14:13.360 --> 00:14:14.480
<v Speaker 1>to add to a file.

302
00:14:14.559 --> 00:14:18.279
<v Speaker 2>Use perster the double greater than a pens stda ut

303
00:14:18.440 --> 00:14:20.320
<v Speaker 2>to the end of the file. Much safer. If you

304
00:14:20.360 --> 00:14:21.720
<v Speaker 2>want to keep existing.

305
00:14:21.279 --> 00:14:25.480
<v Speaker 1>Content overwrites a pens Got it? What about st er

306
00:14:25.720 --> 00:14:27.080
<v Speaker 1>the error messages.

307
00:14:26.679 --> 00:14:29.960
<v Speaker 2>You redirect STDOJ using too the two refers to file

308
00:14:30.000 --> 00:14:32.799
<v Speaker 2>descriptor two, which is st e R. So something like

309
00:14:32.840 --> 00:14:35.919
<v Speaker 2>fine dash name dot log two finders dot txt would

310
00:14:36.000 --> 00:14:38.960
<v Speaker 2>run the find command, but any permission denied errors would

311
00:14:38.960 --> 00:14:41.519
<v Speaker 2>go into finders dot txt. Not clutter your screen.

312
00:14:41.840 --> 00:14:45.279
<v Speaker 1>Ah, separating the good output from the bad useful? Can

313
00:14:45.320 --> 00:14:46.720
<v Speaker 1>you send both to the same place?

314
00:14:46.879 --> 00:14:49.639
<v Speaker 2>Yes, you can use an snore or the slightly older

315
00:14:49.679 --> 00:14:52.840
<v Speaker 2>two and one. Both redirect stdo and SDDO to the

316
00:14:52.840 --> 00:14:56.360
<v Speaker 2>same file. Great for capturing absolutely everything at command outputs

317
00:14:56.480 --> 00:14:58.919
<v Speaker 2>errors included for logging or later analysis.

318
00:14:58.960 --> 00:15:01.720
<v Speaker 1>Okay, redirection, let's us manage output. But the ultimate connector

319
00:15:01.960 --> 00:15:04.240
<v Speaker 1>the pipe. This is where the magic of chaining commands

320
00:15:04.240 --> 00:15:05.159
<v Speaker 1>really happens, isn't it.

321
00:15:05.159 --> 00:15:07.639
<v Speaker 2>It truly is the pipe character that vertical bar. It's

322
00:15:07.679 --> 00:15:08.600
<v Speaker 2>a complete game changer.

323
00:15:08.679 --> 00:15:10.080
<v Speaker 1>It's what does it do technically?

324
00:15:10.399 --> 00:15:13.320
<v Speaker 2>It takes the sdbout of the command before the pipe

325
00:15:13.600 --> 00:15:16.279
<v Speaker 2>and feeds it directly as the SDDI in to the

326
00:15:16.320 --> 00:15:17.440
<v Speaker 2>command after the pipe.

327
00:15:17.559 --> 00:15:20.320
<v Speaker 1>Whoa, so output becomes input Exactly.

328
00:15:20.360 --> 00:15:22.759
<v Speaker 2>It's like building an assembly line for your data right

329
00:15:22.759 --> 00:15:26.279
<v Speaker 2>there on the command line. You filter, process, count, transform

330
00:15:26.320 --> 00:15:29.840
<v Speaker 2>step by step like our earlier example. Yep rep binbash

331
00:15:29.879 --> 00:15:35.279
<v Speaker 2>et cetera, rep binbash, et cetera PASTWCDL.

332
00:15:34.080 --> 00:15:38.039
<v Speaker 1>Right grep finds the lines stdout. The pipe sends those

333
00:15:38.080 --> 00:15:42.639
<v Speaker 1>lines to wc as stdin, and WCDL counts them. Brilliant.

334
00:15:42.679 --> 00:15:45.600
<v Speaker 2>It lets you combine simple tools to do complex tasks

335
00:15:45.679 --> 00:15:47.759
<v Speaker 2>without creating temporary files all the time.

336
00:15:47.879 --> 00:15:51.279
<v Speaker 1>I love that building complex operations from simple parts. Now,

337
00:15:51.320 --> 00:15:53.200
<v Speaker 1>what if you want to see the output and save

338
00:15:53.200 --> 00:15:55.399
<v Speaker 1>it to a file simultaneously? Do you have to run

339
00:15:55.440 --> 00:15:56.200
<v Speaker 1>it twice? Nope.

340
00:15:56.279 --> 00:15:57.360
<v Speaker 2>That's where the T command comes in.

341
00:15:57.440 --> 00:15:59.519
<v Speaker 1>With the T like a T junction in plumbing.

342
00:15:59.600 --> 00:16:02.720
<v Speaker 2>Exactly like that, it reads from stdi in and writes

343
00:16:02.759 --> 00:16:06.080
<v Speaker 2>both to std out your screen and to a file

344
00:16:06.120 --> 00:16:09.720
<v Speaker 2>you specify. So greb binbasha, et cetera, pass roodett Bash

345
00:16:09.840 --> 00:16:12.440
<v Speaker 2>users dot txt. You'll see the list of Bash users

346
00:16:12.440 --> 00:16:14.519
<v Speaker 2>on the screen, and they'll be saved in Bash users

347
00:16:14.519 --> 00:16:15.399
<v Speaker 2>dot txt that.

348
00:16:15.399 --> 00:16:18.519
<v Speaker 1>Is incredibly handy auditing, reporting, just keeping a record.

349
00:16:19.159 --> 00:16:21.879
<v Speaker 2>And another powerful tool that works beautifully with pipes is

350
00:16:22.200 --> 00:16:24.120
<v Speaker 2>Here's on the stream editor.

351
00:16:24.159 --> 00:16:27.080
<v Speaker 1>Stream editor it edits data as it flows.

352
00:16:26.799 --> 00:16:30.440
<v Speaker 2>Through precisely, it performs text transformations on the fly. The

353
00:16:30.480 --> 00:16:35.039
<v Speaker 2>classic example is substitution echo I like cake, said scape donuts.

354
00:16:35.360 --> 00:16:39.639
<v Speaker 2>The said command gets I like cake as input, replaces

355
00:16:39.679 --> 00:16:42.960
<v Speaker 2>cake with donuts, and outputs I like donuts.

356
00:16:42.639 --> 00:16:44.840
<v Speaker 1>Find and replaced. But in a live stream.

357
00:16:45.240 --> 00:16:45.559
<v Speaker 2>Wow.

358
00:16:45.720 --> 00:16:48.639
<v Speaker 1>Okay. Speaking of powerful tools that work with input, I

359
00:16:48.639 --> 00:16:50.960
<v Speaker 1>think I heard the source mentioned one that sounds a

360
00:16:51.000 --> 00:16:53.919
<v Speaker 1>bit like a pirate. Does zargs ring a bell? Ah?

361
00:16:54.000 --> 00:16:56.960
<v Speaker 2>Yes, the mighty zarks. It definitely sounds a bit pyraty.

362
00:16:57.039 --> 00:16:59.879
<v Speaker 1>How does it do? It sounds important for building commands.

363
00:16:59.559 --> 00:17:02.720
<v Speaker 2>It's fantas pastic For dynamic command building. Zargs reads items

364
00:17:02.720 --> 00:17:05.279
<v Speaker 2>from standard input, usually lines of text, and builds and

365
00:17:05.359 --> 00:17:08.319
<v Speaker 2>executes command lines using those items as arguments.

366
00:17:08.440 --> 00:17:11.839
<v Speaker 1>So if one command outputs a list of files.

367
00:17:11.559 --> 00:17:14.279
<v Speaker 2>Dotrics can take that list and feed each file name

368
00:17:14.359 --> 00:17:17.480
<v Speaker 2>as an argument to another command like RM or CP

369
00:17:17.880 --> 00:17:21.720
<v Speaker 2>or anything else. For example, LS one emptyfile, dot txt,

370
00:17:22.119 --> 00:17:26.680
<v Speaker 2>zargs dot pusrbin, RM, dotch. One's dotch one lists the

371
00:17:26.720 --> 00:17:30.240
<v Speaker 2>matching files one per line. Zargs takes each line file

372
00:17:30.359 --> 00:17:32.960
<v Speaker 2>name and runs us arban nerum with that filename as

373
00:17:32.960 --> 00:17:35.759
<v Speaker 2>an argument. The dot p makes it prompt you first,

374
00:17:35.960 --> 00:17:37.880
<v Speaker 2>which is safer with RM.

375
00:17:37.440 --> 00:17:40.480
<v Speaker 1>So it turns a list into action arguments. That's incredibly

376
00:17:40.519 --> 00:17:42.519
<v Speaker 1>powerful for batch operations, it really is.

377
00:17:42.599 --> 00:17:44.920
<v Speaker 2>It lets you connect commands in ways that simple piping

378
00:17:44.960 --> 00:17:47.440
<v Speaker 2>sometimes can't handle, especially when you need to use the

379
00:17:47.480 --> 00:17:50.160
<v Speaker 2>input as command line arguments rather than just standard input.

380
00:17:50.599 --> 00:17:53.359
<v Speaker 2>Now why should you care about all this redirection piping,

381
00:17:53.440 --> 00:17:56.599
<v Speaker 2>t said zarg stuff. Because these techniques let you grab

382
00:17:56.640 --> 00:18:00.599
<v Speaker 2>information instantly, process huge log files, sufficiently filtered dat exactly

383
00:18:00.640 --> 00:18:02.880
<v Speaker 2>how you need it for reports, and automate task as

384
00:18:02.920 --> 00:18:05.720
<v Speaker 2>it would be incredibly tedious or even impossible to do manually.

385
00:18:06.039 --> 00:18:08.960
<v Speaker 2>You're essentially building these tiny specialized programs right there on

386
00:18:09.000 --> 00:18:12.759
<v Speaker 2>the command line. You're customizing your workflow to an unbelievable degree.

387
00:18:12.920 --> 00:18:15.400
<v Speaker 2>It really unlocks the full power of Linux for efficiency

388
00:18:15.400 --> 00:18:15.960
<v Speaker 2>and precision.

389
00:18:16.119 --> 00:18:19.240
<v Speaker 1>Wow. We've really only just scratched the surface of the

390
00:18:19.279 --> 00:18:22.119
<v Speaker 1>Linux command line here, haven't we, But what a powerful

391
00:18:22.160 --> 00:18:25.839
<v Speaker 1>surface it is. We've seen how understanding the shell is key,

392
00:18:25.960 --> 00:18:29.440
<v Speaker 1>like knowing who you're talking to, then mastering those metacharacters

393
00:18:29.440 --> 00:18:33.000
<v Speaker 1>and quoting, speaking the Shells language correctly, and then leveraging

394
00:18:33.079 --> 00:18:37.640
<v Speaker 1>that incredible power of streams, pipes, redirection, rep sort sargs,

395
00:18:38.319 --> 00:18:43.000
<v Speaker 1>turning these complex tasks into simple, almost elegant solutions.

396
00:18:43.200 --> 00:18:47.039
<v Speaker 2>That's exactly it. It's not just about memorizing commands in isolation.

397
00:18:47.160 --> 00:18:50.680
<v Speaker 2>It's about understanding how they fit together, how you chain them,

398
00:18:50.920 --> 00:18:54.359
<v Speaker 2>how you harness their individual strengths to achieve much bigger things.

399
00:18:54.640 --> 00:18:57.759
<v Speaker 2>It's about building a workflow that's efficient for you, that's

400
00:18:57.799 --> 00:18:59.920
<v Speaker 2>precise and incredibly flexible.

401
00:19:00.119 --> 00:19:02.160
<v Speaker 1>So as you go back to your own systems, maybe

402
00:19:02.160 --> 00:19:05.799
<v Speaker 1>think about this, what hidden data, what automation possibilities are

403
00:19:05.839 --> 00:19:07.960
<v Speaker 1>just waiting for you to uncover on your Linux system

404
00:19:08.000 --> 00:19:11.160
<v Speaker 1>just by combining these simple yet incredibly powerful commands and

405
00:19:11.200 --> 00:19:13.319
<v Speaker 1>new ways, go forth and explore and see what you

406
00:19:13.359 --> 00:19:13.759
<v Speaker 1>can build
