Speaker 1: All right, get ready to dive into the world to
Speaker 1: the Linux command line. Yeah, we're going to turn you
Speaker 1: into a command line ninja with this twenty twenty one
Speaker 1: edition of the Linux command Line and Shell Scripting Bible.
Speaker 2: This book, oh wow, the Bible.
Speaker 1: Huh, it's a big one.
Speaker 2: Yeah.
Speaker 1: We've got basic commands, advanced commands. Yeah, we're going to
Speaker 1: get into managing files and directories, understanding how the shell
Speaker 1: actually works, working with data, and then even getting into
Speaker 1: the scripting side of things.
Speaker 2: Yeah, this is going to be fun.
Speaker 1: So you navigate the file system like a pro, write
Speaker 1: some really cool scripts.
Speaker 2: I think a good place to start would be just
Speaker 2: talking about the different ways that you can even access
Speaker 2: the command line.
Speaker 1: Okay, yeah, that's a good point. So you've got like
Speaker 1: virtual consoles, graphical terminal emulators. That's just like a fancy
Speaker 1: way of saying the same thing.
Speaker 2: Well, I would say it's important to know the difference
Speaker 2: because it affects how you interact with the system. So
Speaker 2: when you think about virtual consoles, you want to think
Speaker 2: about it's like a direct connection to your system's heart.
Speaker 2: It runs right on the system memory. Oh, so it
Speaker 2: gives you that old school no frills command line experience. Now,
Speaker 2: terminal emulators are like command line windows within your graphical
Speaker 2: desktop environment. Okay, they're going to give you more flexibility
Speaker 2: and features, but they do have a little bit of
Speaker 2: a performance trade off.
Speaker 1: Yeah, I guess that makes sense. It has to run
Speaker 1: inside of the graphical environment. Okay, So choosing between those
Speaker 1: two is like choosing if you're going to be a
Speaker 1: survivalist or if you want like the modern conveniences of
Speaker 1: the graphical environment. But in both cases you're still using
Speaker 1: that command line. So now that we're in the command line,
Speaker 1: how do you find your way around? It's not like
Speaker 1: Windows with folders and icons and all of that.
Speaker 2: That's right. So we've got the Linux file structure. It
Speaker 2: is quite a bit different from what you might be
Speaker 2: used to, but once you grasp it, it's pretty logical
Speaker 2: actually and efficient. Fit like a tree with the root
Speaker 2: directory as the trunk. Everything kind of branches out from there.
Speaker 1: I see.
Speaker 2: And then here's where it gets interesting. Mount points Okay,
Speaker 2: you know those are those connectors that let you attach
Speaker 2: additional storage devices like hard drives USB drives, Yeah, and
Speaker 2: make them appear as part of this unified tree structure.
Speaker 1: So no matter where I plug a new device in,
Speaker 1: it's going to show.
Speaker 2: Up in that one seamlessly integrated.
Speaker 1: Okay, it's pretty cool. But with all those directories and files,
Speaker 1: how do you it can get.
Speaker 2: A little bit daunting. Yeah, especially with those really long
Speaker 2: file names that Lennox.
Speaker 1: Is known for. Right, yeah, yeah, exactly, exactly.
Speaker 2: Yeah. So you've got a master tab completion. Okay, that's
Speaker 2: your first step towards being a command line ninja. Right,
Speaker 2: just start typing a command or file name, hit the
Speaker 2: tab key, and then the shell will just magically complete
Speaker 2: it for you. It's going to give you suggestions. It
Speaker 2: is a real time saver, right.
Speaker 1: Find me up for that. So I've got tab completion.
Speaker 1: What other tips?
Speaker 2: Okay? So another tip is to look out for those
Speaker 2: hidden files.
Speaker 1: Okay.
Speaker 2: They start with a period, and they're normally invisible, right okay,
Speaker 2: and they often contain some pretty important configuration settings or
Speaker 2: system data. So if you ever need to delve into
Speaker 2: that hidden world, the LSA command is your go to.
Speaker 2: It's like putting on X ray vision for the file system.
Speaker 1: Oh okay, So I need to be careful not to
Speaker 1: delete anything that I can't see them. If it's important, you.
Speaker 2: Don't want to accidentally delete something important?
Speaker 1: Yeah, yeah, okay, Now let's get into actually managing these files, right,
Speaker 1: I mean, what good is a command line if you
Speaker 1: can't move, copy, delete these files?
Speaker 2: Absolutely, So this book it dives into those essential commands
Speaker 2: CEE for copying, m V for moving or renaming, and
Speaker 2: then of course we've got the infamous RMM for deleting. Yeah,
Speaker 2: but before you go on a deleting spree, we've got
Speaker 2: to talk about.
Speaker 1: In noodes innodess a little technical.
Speaker 2: Yeah, they are a little technical, but they're also very cool.
Speaker 2: They're like unique fingerprints for each file. So even if
Speaker 2: you change a file's name or move it, it's in
Speaker 2: a number stays the same.
Speaker 1: So it's not just about the name, that's right, it's
Speaker 1: an underlying identifier. Okay, So imagine if you need to
Speaker 1: find a file that's been moved or renamed. In odes
Speaker 1: are your secret weapon. I see, Yeah, you can find
Speaker 1: that file no matter where it is. Wow.
Speaker 2: Okay, yeah, Now what about dealing with the output of commands?
Speaker 2: Sometimes you get this massive wall.
Speaker 1: Of text that's right scrolling by.
Speaker 2: Is there a way to kind of capture that information?
Speaker 1: Yes, So that's where we've got output redirection. Okay, this
Speaker 1: is one of those aha moments. Once you learn how
Speaker 1: to use it. The symbol is your friend here. Okay,
Speaker 1: you can readirect the output of a command to a file,
Speaker 1: so instead of seeing it on the screen, you can
Speaker 1: capture it, put it in a file, and use it
Speaker 1: later for analysis or reference. Oh that's so useful. Yeah,
Speaker 1: instead of it just flying by on the screen.
Speaker 2: Yeah, just capture it.
Speaker 1: You can actually. Yeah, okay, brilliant.
Speaker 2: Yeah, it's a good one.
Speaker 1: Now we keep hearing the word shell. Exactly is a shell?
Speaker 2: Ah? Yes, the shell?
Speaker 1: And why should I care about it?
Speaker 2: The shell? So think about this. This is your command
Speaker 2: line interpreter, the bridge between you and the Linux kernel,
Speaker 2: which is the heart of the operating system. Right, So
Speaker 2: it's taking your commands, figuring out what you mean, and
Speaker 2: then it instructs the kernel to make it happen.
Speaker 1: Gotcha.
Speaker 2: And there's not just one shell. There's several.
Speaker 1: Oh interesting, So I don't have to just use one shell.
Speaker 2: No, And this book delves into the different types of shells,
Speaker 2: like the very popular beast shell off in the default,
Speaker 2: and then you have alternatives like TS and DASH.
Speaker 1: Wow. Okay, so there's each one has its choices.
Speaker 2: Yeah, they each have their own personality, their own quirks strengths.
Speaker 1: So it's like choosing your weapon, choosing your.
Speaker 2: Exactly which one fits your style and needs.
Speaker 1: Now, every time I hit enter, it creates a child process.
Speaker 2: That's right, a child process to handle that command.
Speaker 1: So there's a whole family going on every time I
Speaker 1: hit a key.
Speaker 2: It's like a parent shell gives both to it childs
Speaker 2: shell to kind of carry out your instructions.
Speaker 1: I see. Okay. And then they also mentioned subshells are
Speaker 1: subshells like the rebellious teenager of the shell world.
Speaker 2: Huh.
Speaker 1: I like that.
Speaker 2: Yeah, kind of subshells are temporary shells created within your
Speaker 2: main shell. Okay, So think of it as a sandbox
Speaker 2: where you can play around commands and environment variables without
Speaker 2: really affecting your main shell.
Speaker 1: So if I mess up in the subshell, it doesn't
Speaker 1: blow up my main shell exactly.
Speaker 2: That's the beauty of it. What happens in the subshell
Speaker 2: stays in the subshell.
Speaker 1: Okay, I like that. Yeah, all right, now let's talk
Speaker 1: about environment variables.
Speaker 2: Hmmm.
Speaker 1: That sounds a little bit intimidating.
Speaker 2: I know, I know they can be. Yeah, but think
Speaker 2: about like this. They're the settings that control how your
Speaker 2: shell and other programs behave. So it's like a behind
Speaker 2: the scenes control panel for your system.
Speaker 1: I see.
Speaker 2: Now you have global environment variables those apply system wide, okay,
Speaker 2: and then you have local ones, which are specific to
Speaker 2: your current shell session.
Speaker 1: So global or like the laws of the Lenox universe,
Speaker 1: and local are like my own personal preference.
Speaker 2: There you go. Okay, that's a great way to put it.
Speaker 1: Now. The book mentions these VIP environment variables. Yes, like path, home, shell, term.
Speaker 2: It's a path.
Speaker 1: Yeah, where are those?
Speaker 2: So? Path that tells the shell where to look for
Speaker 2: executable commands. Okay, so it's like a roadmap guiding the
Speaker 2: shell to find those tools.
Speaker 1: Gotcha.
Speaker 2: And then home that points to your home directory, your
Speaker 2: personal space within that file system. Shell specifies which shell
Speaker 2: you're using, and then term defines your terminal type okay,
Speaker 2: so that programs understand how to display information properly.
Speaker 1: So these variables are kind of like setting the stage
Speaker 1: for how everything's going to do.
Speaker 2: That's right, how everything is going to run okay. Yeah,
Speaker 2: and then you've got commands like set envy and print him.
Speaker 2: Those are going to be your tools for viewing and
Speaker 2: manipulating these environment variables.
Speaker 1: So we can actually modify these settings totally customize our environments. Yep.
Speaker 1: All right, Now we need to talk about these shell
Speaker 1: startup files okay, before we get too far into the
Speaker 1: scripting side.
Speaker 2: Right, So these are those secret ingredients that make your
Speaker 2: shell experience really personalized. Okay, So shell startup files like
Speaker 2: et cetera profile, dot bash profile, dot bash rc. There're
Speaker 2: scripts that run every time you log in or start
Speaker 2: a new shell session.
Speaker 1: So it's like a set of instructions for how the
Speaker 1: shell's going.
Speaker 2: To exactly how it's going to set up. Okay, you
Speaker 2: know you can customize your command prompt, set environment variables,
Speaker 2: define aliases for those frequently used commands. Wow.
Speaker 1: So it's like my own little personal exactly. It's like
Speaker 1: your assistant.
Speaker 2: It's like having a personal assistant just for your shell,
Speaker 2: taking care of all the yeah, taking care of all
Speaker 2: the tedious stuff so you can focus on the fun stuff.
Speaker 1: Okay, So now we've got our environments set up, it's
Speaker 1: time to write a shell script.
Speaker 2: All right? Are you ready?
Speaker 1: Yeah? How do we bring these shell scripts to life?
Speaker 2: All right? So first thing you want to do is
Speaker 2: you want to create a simple text file. Okay, you're
Speaker 2: going to write your commands in plain text, just like
Speaker 2: you would type them at the command line, right, and
Speaker 2: then you need to make that script executable using the
Speaker 2: chron command.
Speaker 1: So we're giving it permission to do its things.
Speaker 2: Exactly, you're giving it permission to do its thing. You're
Speaker 2: changing the file permissions and telling the system, hey, this
Speaker 2: is a program. This can be executed.
Speaker 1: Gotcha. So what kind of commands can we put inside
Speaker 1: of these scripts?
Speaker 2: So you've got the Echo command. That's your basic communication tool.
Speaker 1: Okay.
Speaker 2: You can display messages on the screen, so it's good
Speaker 2: for providing feedback or debugging your script.
Speaker 1: So if I wanted to say Hello World, I could
Speaker 1: do that with Echo.
Speaker 2: You got it. Echo is your friend?
Speaker 1: All right? What about making these scripts a little more dynamic,
Speaker 1: like working with data?
Speaker 2: Ah? Okay, so we're going to bring in variables.
Speaker 1: Okay.
Speaker 2: Variables are like containers that hold data within your script.
Speaker 2: So think of them as like labeled boxes store information
Speaker 2: and then refer to that information by that label or
Speaker 2: variable name.
Speaker 1: So it's like giving the script a memory.
Speaker 2: Then you got it. You're giving it a memory. And
Speaker 2: this book shows you how to assign values to those variables,
Speaker 2: and then use those values within your script. It even
Speaker 2: shows you how to capture the output of a command
Speaker 2: and store that in a variable.
Speaker 1: Really yeah, so I could run a command and then
Speaker 1: take that output and use it somewhere else.
Speaker 2: And feed it into your script. Yeah.
Speaker 1: That's awesome.
Speaker 2: Yeah, that's a good one.
Speaker 1: So how do you do that?
Speaker 2: So there's a couple of ways to do it. One
Speaker 2: is using backticks. That's the older syntax okay, and then
Speaker 2: you've got the newer syntax for command substitution.
Speaker 1: Okay.
Speaker 2: Both achieve the same goal. They're capturing the output of
Speaker 2: that command to data stream and then you can feed
Speaker 2: that into your script, so I.
Speaker 1: Can build mini pipelines right inside my script. That's right. Wow, yeah,
Speaker 1: pretty cool? Right, this is really cool. Yeah.
Speaker 2: So we've covered the foundations of shell scripting here, but
Speaker 2: there's so much more to explore.
Speaker 1: I'm ready. What's coming up next?
Speaker 2: Okay? Well, next we're going to dive into more advanced
Speaker 2: scripting techniques like conditional statements and loops. Those allow your
Speaker 2: scripts to make decisions and repeat actions.
Speaker 1: Okay, cool, let's get into it all right, So.
Speaker 2: Are you ready to go beyond those scripting basics and
Speaker 2: give those scripts some intelligence.
Speaker 1: I'm ready.
Speaker 2: How do we do that with conditional statements and loops?
Speaker 1: Ooh that sounds interesting.
Speaker 2: Yeah, they're really cool. It's like adding a brain to
Speaker 2: your script so they can adapt to different situations and
Speaker 2: automate those tedious, repetitive tasks. Right.
Speaker 1: Oh yeah, yeah, okay, so let's start with conditional statements.
Speaker 1: How do those work? It kind of sounds like teaching
Speaker 1: the script to think.
Speaker 2: Yeah, it's kind of like that the if then statement. Okay,
Speaker 2: it's your building block for decision making. You know. Think
Speaker 2: of it like a gatekeeper evaluating a condition and only
Speaker 2: letting those commands through if the condition is true.
Speaker 1: So it's like saying, hey, script, if this is true,
Speaker 1: then do that. If not, skip it, that's right. Okay,
Speaker 1: what kind of condition can we actually put in there?
Speaker 2: Well? Remember those exit status codes. You know, the command
Speaker 2: typically exists with the status of zero if it's successful,
Speaker 2: or a non zero status if there's an error. Right, right, Well,
Speaker 2: conditional statements use those statuses to make decisions.
Speaker 1: Oh okay, so the command is actually reporting back to
Speaker 1: the script saying hey I did it, or hey I
Speaker 1: had a problem that's right. You decide what to do
Speaker 1: next exactly.
Speaker 2: So in an if then statement, if that preceding command
Speaker 2: exits with a zero, the commands in the then block
Speaker 2: get executed. Otherwise they get skipped.
Speaker 1: Okay, So what if you want to have an alternative
Speaker 1: like run these commands if it's true, but if not,
Speaker 1: then do something else.
Speaker 2: Ah, so you want a backup plan?
Speaker 1: Yeah, exactly.
Speaker 2: Well that's where if then else comes in. It's giving
Speaker 2: your scripts two possible paths. Okay, one for when the
Speaker 2: condition is true and one for when it's false.
Speaker 1: I like having options. You got it now. I also
Speaker 1: see nested if statements. Yes, are those like nsted if statements?
Speaker 1: Those rush yes exactly, like those Russian nesting dolls with
Speaker 1: one if statement inside of another. Okay, So that allows
Speaker 1: you to create more complex decision making logic. You know,
Speaker 1: it's like creating a multi level decision tree.
Speaker 2: So it's like adding layers of intelligence to that script.
Speaker 1: That's right.
Speaker 2: It can evaluate more sophisticated scenarios.
Speaker 1: Exactly.
Speaker 2: Wow. Okay, now we need to talk about loops.
Speaker 1: Okay, So loops for those repetitive tasks exactly. Loops are
Speaker 1: the workhorses of automation. Okay, the book covers several types
Speaker 1: of loops, for loops and wild loops.
Speaker 2: You know, imagine if you had to process one hundred files,
Speaker 2: or maybe you're waiting for a specific condition to change. Yeah,
Speaker 2: you know loops. Let you handle those situations without writing
Speaker 2: the same commands over and over again.
Speaker 1: Okay, yeah, I can see where that would get really tedious.
Speaker 2: Yeah, I would get really tedious.
Speaker 1: Okay, let's start with the four loop.
Speaker 2: All right. So the four loop.
Speaker 1: How does that one work?
Speaker 2: It's design to iterate through a list of values, okay,
Speaker 2: and execute a set of commands for each value. It's
Speaker 2: like a processing You take each item from that list,
Speaker 2: you run it through the same set of instructions.
Speaker 1: Gotcha. So if I had a list of file names,
Speaker 1: I could run the same action on all those files exactly.
Speaker 1: That's pretty cool. What about the wile loop?
Speaker 2: All right? So the wile loop?
Speaker 1: Why would I use that one?
Speaker 2: So the wile loop is like this persistent little engine. Okay,
Speaker 2: It keeps running as long as a specific condition remains true. Okay,
Speaker 2: So it's perfect for situations where you don't know in
Speaker 2: advance how many times you need to repeat those commands.
Speaker 2: So imagine you're monitoring a system log file okay, and
Speaker 2: you're waiting for a specific error message to appear. Yeah,
Speaker 2: a while loop can keep checking that file, oh okay
Speaker 2: until that message pops out.
Speaker 1: Yeah, so it's just constantly checking and checking.
Speaker 2: Until exactly continually monitoring.
Speaker 1: Okay. What if I need to bail out of a
Speaker 1: loop early?
Speaker 2: Ah, well, we've got the brake command for that.
Speaker 1: Okay.
Speaker 2: You know, that's your emergency exit for loops. So if
Speaker 2: a certain condition is met within that loop, yeah, break,
Speaker 2: we'll stop it right there, preventing any further iteration, like.
Speaker 1: The loop stopping Superhero.
Speaker 2: That's right, that's right. So what about skipping over certain
Speaker 2: iterations of a loop?
Speaker 1: Oh? Yeah? What if I want to just process certain
Speaker 1: files like that meet certain criteria.
Speaker 2: Well, for that, you have the continued command OKA that
Speaker 2: lets you jump to the next iteration of the loop
Speaker 2: without executing those remaining commands.
Speaker 1: It's like, nope, not that one, move on to the
Speaker 1: next exactly exactly. Okay. These loop control commands are really cool.
Speaker 1: So I've got conditional statements for decision making, we've got
Speaker 1: loops for repeating actions. What else can we do to
Speaker 1: make our scripts a little more interactive and powerful.
Speaker 2: Well, how about giving them the ability to take constructions
Speaker 2: directly from the user? Oh okay, you know with command
Speaker 2: line parameters.
Speaker 1: Okay, so like giving it instructions or settings when I
Speaker 1: start the.
Speaker 2: Script exactly exactly. You know, you pass information to the
Speaker 2: script when you run it, customize its behavior on the fly.
Speaker 1: Okay.
Speaker 2: Within the script, you access those parameters using special variables
Speaker 2: like one dollar, two dollars, and so on. One dollars
Speaker 2: is the first parameter, two dollars is the second.
Speaker 1: Okay, that's pretty straightforward. What if I've got a script
Speaker 1: that takes a bunch of parameters, Well, you know, the.
Speaker 2: Book explains special variables like hashtag that gives you the
Speaker 2: total number of parameters past ok and then you have
Speaker 2: at which lets you access all of them as a
Speaker 2: single unit.
Speaker 1: Gotcha.
Speaker 2: And then there's even a clever trick to access the
Speaker 2: very last parameter using ash.
Speaker 1: Wow. It's pretty handy.
Speaker 2: Yeah, it's pretty handy. So how about those single letter
Speaker 2: command line options, right, you know, like L for the long.
Speaker 1: Listing with l's Yeah, yeah, exactly.
Speaker 2: You can use those in your scripts too.
Speaker 1: Really.
Speaker 2: Yeah, So the book outlines three ways to handle those options, okay,
Speaker 2: so you can process them directly as parameters. You can
Speaker 2: use if statements to check for specific options, or the
Speaker 2: most elegant approach is to use the get tops command
Speaker 2: get tops get tops. You know that's your built in
Speaker 2: option parsing wizard.
Speaker 1: Oh wow.
Speaker 2: It handles both short and long options, whether they have
Speaker 2: associated values or not.
Speaker 1: Wow.
Speaker 2: And you can even specify which options are expected.
Speaker 1: So it's kind of streamlining all that option handling exactly.
Speaker 2: It streamlines it and makes it more robust.
Speaker 1: Okay, very cool. So we've got conditional statements, loops, we've
Speaker 1: got these command line parameters and options. Anything else we
Speaker 1: can do well.
Speaker 2: One of the most powerful techniques is to encapsulate those
Speaker 2: reusable code blocks into functions.
Speaker 1: Functions okay, yeah, functions in programming.
Speaker 2: Yeah, just like in programming. They are like mini scripts
Speaker 2: within your main script. They help you avoid repetition and
Speaker 2: make it way more readable and maintainable. Okay, it's like
Speaker 2: building your own custom command library.
Speaker 1: Oh that's cool. So I can create my own commands,
Speaker 1: that's right.
Speaker 2: And the book walks you through defining those functions, okay,
Speaker 2: giving them names, calling them. When you need that specific functionality,
Speaker 2: you can even pass arguments to functions, just like you
Speaker 2: do with regular commands.
Speaker 1: So it's like building as some toolbox of all these
Speaker 1: components exactly all right, Now the book mentions this local keyword. Yes,
Speaker 1: what is local all about?
Speaker 2: So local is your friend when it comes to keeping
Speaker 2: variables organized within those functions. It lets you declare variables
Speaker 2: that are only visible inside that function. Okay, prevents naming
Speaker 2: conflicts with variables in your main scriptstcha, you know, other functions.
Speaker 2: It's good practice to use local variables within functions to
Speaker 2: keep things nice and tidy.
Speaker 1: Okay. So it's like giving each function its own little workspace.
Speaker 2: That's right, its own little private.
Speaker 1: Workspace prevents them from interfering with each other exactly. Okay. Now,
Speaker 1: Linux has a ton of commands and utilities built in.
Speaker 1: Are there any external tools? Yes, that can help us
Speaker 1: with scripting.
Speaker 2: So there is a package called stool Okay, you know,
Speaker 2: think of that like your Swiss army knife for scripting.
Speaker 1: Right.
Speaker 2: It provides a collection of pre built functions for all
Speaker 2: sorts of common tasks, from platform to detection, text manipulation,
Speaker 2: interactive prompts.
Speaker 1: So it's like having a whole team of expert scriptwriters
Speaker 1: at my disposal.
Speaker 2: That's right. That's right.
Speaker 1: That's really cool. So I can use those functions both
Speaker 1: from the command line and within my scripts.
Speaker 2: That's right. Gives you a lot of flexibility.
Speaker 1: Wow. Okay, we've covered a lot we have. We've covered
Speaker 1: advanced scripting techniques, We've looked at external tools. One thing
Speaker 1: we haven't talked about, though, is how do you actually
Speaker 1: write these scripts? Ah?
Speaker 2: Yes, so what tools are we actually using?
Speaker 1: Yeah? Are we just using a plain text editor? Is
Speaker 1: there anything more specialized?
Speaker 2: Yeah? So choosing the right text editor can really boost
Speaker 2: that scripting productivity.
Speaker 1: Okay.
Speaker 2: The book dedicates a whole chapter to exploring various text
Speaker 2: editors like Vim, Emacs, Nano, k Write, Kate, get it.
Speaker 1: Wow. That's a lot.
Speaker 2: Yeah, quite a lineup, right.
Speaker 1: Are there any standouts? What would you recommend for someone
Speaker 1: just starting out?
Speaker 2: Well, really depends on personal preference, learning style.
Speaker 1: You know.
Speaker 2: Vim is renowned for its power and efficiency, but it
Speaker 2: does have a steep learning curve.
Speaker 1: I've heard it's a blessing and a curse.
Speaker 2: Yeah, that's a good way to put it. You know.
Speaker 2: Emacs is another powerhouse known for its extensibility and customizability,
Speaker 2: but it also has a learning curve.
Speaker 1: Okay.
Speaker 2: Nano is a more simple, user friendly editor, good for
Speaker 2: quick edits, Okay, might be good for beginners.
Speaker 1: So there's kind of an editor for everyone's right, every taste?
Speaker 2: Yeah, for every taste.
Speaker 1: Now, what about those graphical editors like k write and
Speaker 1: kate and get it.
Speaker 2: So those offer a more visual and intuitive editing experience. Okay,
Speaker 2: you know they features like syntax highlighting, autocompletion, even built
Speaker 2: in terminal emulators, which can be super helpful for testing
Speaker 2: your scripts as you write them.
Speaker 1: Oh okay, Yeah, so we've got our scripting environment set up. Okay,
Speaker 1: we've learned how to write scripts, make them interactive, automate tasks,
Speaker 1: and even organize our code with functions. That's right. What
Speaker 1: else is there? What other powerful techniques are out there?
Speaker 2: Well? Next app will delve into the world of data
Speaker 2: manipulation and unlock those secrets of Said and Gok and
Speaker 2: discover the power of regular expressions.
Speaker 1: Set in gowk. Those sound like characters from a sci
Speaker 1: fi movie.
Speaker 2: Ah, yeah, they do.
Speaker 1: What are we getting into?
Speaker 2: Don't worry, They're not as intimidating as they sound. Okay,
Speaker 2: you know Said and Gok are powerful text processing tools
Speaker 2: that can transform, filter, and analyze data with incredible speed
Speaker 2: and precision.
Speaker 1: All right, I'm ready to hear more about these SET
Speaker 1: and GOCK tools. So these SET and GOCK tools tell
Speaker 1: me more.
Speaker 2: Yeah. So SAID stands for stream editor, okay, and it's
Speaker 2: all about working on streams of text, processing data line
Speaker 2: by line. So imagine you have a massive log file
Speaker 2: or a databased stump. Instead of loading the whole thing
Speaker 2: into memory, right, said, lets you process it efficiently one
Speaker 2: line at a time.
Speaker 1: Oh okay.
Speaker 2: You can make changes, you can extract information, even transform
Speaker 2: the entire structure.
Speaker 1: It's like a specialized assembly line for text. Exactly each
Speaker 1: line is going through getting modified.
Speaker 2: That's right.
Speaker 1: Okay.
Speaker 2: And one of the keys to Said's power is using
Speaker 2: regular expressions.
Speaker 1: Yeah, regular expressions.
Speaker 2: You know, they might seem a bit cryptic at first.
Speaker 1: Yeah, they can be a little intimidating.
Speaker 2: Yeah, I know. But they're like a secret language for
Speaker 2: pattern matching. Okay, you can specify some really complex search criteria.
Speaker 1: I've seen them used, but I've never really understood how
Speaker 1: they work.
Speaker 2: Yeah, I understand. So the book it breaks them down
Speaker 2: into manageable pieces, explaining like those anchor characters, character classes, quantifiers,
Speaker 2: and even how to combine these to create really specific
Speaker 2: matching rules.
Speaker 1: So it's like learning a new language for working with data.
Speaker 2: That's a great way to put it.
Speaker 1: Okay, can you give me example of how said and
Speaker 1: regular expressions actually work together.
Speaker 2: Sure. Let's say you have a file with a list
Speaker 2: of names. Okay, each one's on a separate line, like
Speaker 2: John Smith, Jane Do, and so on, and you want
Speaker 2: to just extract the last names from those lines. Okay, Well,
Speaker 2: with said and a simple regular expression, you can do
Speaker 2: that instantly. Oh wow, The regular expression would target the
Speaker 2: space between the first and last name. Oky, Intel said
Speaker 2: to only output the part of the line after the space.
Speaker 1: Wow. Okay, yeah, so that's said. What about gok How
Speaker 1: is that different? So?
Speaker 2: Gawk is another powerhouse, but it's more like a programming
Speaker 2: language specifically designed for data manipulation, so it goes beyond
Speaker 2: that simple text manipulation. Allows you to perform calculations, use variables,
Speaker 2: even structure your code with conditional statements and loops, just
Speaker 2: like you would in a traditional programming language.
Speaker 1: It's like having a mini programming environment.
Speaker 2: Yeah, that's a great way to put it.
Speaker 1: Specifically designed for working with data exactly.
Speaker 2: And it's great for tasks like extracting specific fields from
Speaker 2: a file okay, cleaning up MESSI data, generating reports, even
Speaker 2: performing base statistical analysis.
Speaker 1: So GAWK is definitely something I need to learn more about.
Speaker 2: Yeah, it's a good one. And it also uses regular
Speaker 2: expressions for pattern matching just like I said, but GAWK
Speaker 2: offers some additional features and flexibility. What well, you can
Speaker 2: use variables within your regular expressions, making them even more dynamic.
Speaker 1: It's like a turbocharged regular expression engine it is.
Speaker 2: Yeah, and it also has a rich set of built
Speaker 2: in functions for working with strings, arrays, okay, mathematical operations.
Speaker 1: There's so much power in the command line.
Speaker 2: Yeah, it's really amazing all the things you can do.
Speaker 1: It's really making me think differently about what's possible.
Speaker 2: That's right. Now.
Speaker 1: We talked about the Bash shell earlier, but there are
Speaker 1: some alternative shells that we could use too.
Speaker 2: Right, yes, yes, So each shell has its own philosophy,
Speaker 2: features and little quirks. Okay, So this book talks about
Speaker 2: the dash shell. It's a lightweight alternative to Bash, often
Speaker 2: the default shell in Debian based distributions like a Buntu
Speaker 2: because it's so efficient, but it might not have all
Speaker 2: those advanced features.
Speaker 1: So it's kind of like if Bash is a Swiss
Speaker 1: army knife, Dash is like a simple pocket knife.
Speaker 2: There you go, that's a great way to put it.
Speaker 1: Just gets the job done.
Speaker 2: That's right.
Speaker 1: Now, what about this shell?
Speaker 2: Ah, you know, that's like the luxury Sedan of shells, okay,
Speaker 2: known for its power customization features like plug and support
Speaker 2: advanced command line editing.
Speaker 1: So it's for power users who really want to customize
Speaker 1: everything exactly. Wow.
Speaker 2: Yeah. So the book does a great job of highlighting
Speaker 2: the strength and weaknesses of each shell, helps you choose
Speaker 2: the best one for your needs.
Speaker 1: So we've covered file management, shell scripting, data manipulation, even
Speaker 1: alternative shells. Is there anything else in this book that
Speaker 1: we need to know?
Speaker 2: Well, there's one more essential aspect of scripting, especially when
Speaker 2: collaborating or working on complex projects, and that's version control.
Speaker 1: Version control.
Speaker 2: Yeah, version control.
Speaker 1: I've heard that.
Speaker 2: Yeah. It's super important for scripts, okay, just like it
Speaker 2: is for code. It helps you keep track of changes
Speaker 2: to your scripts okay, allows you to revert to previous versions,
Speaker 2: compare different versions, even merge changes from multiple people.
Speaker 1: So it's like a time machine for your scripts exactly.
Speaker 2: So, GET is the most popular version control system out there,
Speaker 2: and the book gives a great overview of those core concepts. Repositories, commits, branches, Okay,
Speaker 2: the importance of using a remote repository.
Speaker 1: For backup, so if I met something up, I can
Speaker 1: always go back. Wow. This has been an incredible journey
Speaker 1: into the world of the Linux command line.
Speaker 2: It has.
Speaker 1: We went from the basics all the way to Wow,
Speaker 1: some really advanced stuff he did. What really stood out
Speaker 1: to me was the versatility and power of the command line.
Speaker 2: Yeah, for sure.
Speaker 1: It's not just about typing in commands. It's about understanding
Speaker 1: how the system works, that's right, and being able to
Speaker 1: create your own tools and automate tasks.
Speaker 2: It really is about taking control of your computing environment.
Speaker 1: Yeah, making it work for you exactly. So for everyone
Speaker 1: listening out there, how can you use these tools and
Speaker 1: scripting skills to automate tasks in your own work or
Speaker 1: personal life.
Speaker 2: Yeah, that's the real challenge, right, and the real fun.
Speaker 2: It's about taking these skills and applying them to those
Speaker 2: real world problems.
Speaker 1: What repetitive tasks can you eliminate?
Speaker 2: That's right?
Speaker 1: What data can you process more efficiently? What tools can
Speaker 1: you create to make your life easier?
Speaker 2: Exactly?
Speaker 1: This has been a great deep dive. Remember, mastering the
Speaker 1: panline is a journey. Keep experimenting, keep learning, keep pushing
Speaker 1: those boundaries, and you'll be amazed at what you can achieve.
Speaker 2: And who knows, maybe one day you'll even teach your
Speaker 2: computer to dance. All right, thanks for joining us, Thanks
Speaker 2: for having me, Mack