Practical Linux Command Line - The Basics You Really Need | Edouard Renard | Skillshare
Drawer
Search

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Practical Linux Command Line - The Basics You Really Need

teacher avatar Edouard Renard, Software Engineer and Robotics Teacher

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Welcome!

      2:59

    • 2.

      How to follow the course

      1:34

    • 3.

      Install Linux (Ubuntu on VirtualBox) - optional

      13:01

    • 4.

      Open a Terminal

      2:10

    • 5.

      Navigate in the Terminal (pwd, ls, cd)

      6:18

    • 6.

      Tips: Autocompletion, History, Clear the Terminal

      4:40

    • 7.

      Linux File System Overview

      4:24

    • 8.

      The Home Directory

      2:20

    • 9.

      Using Absolute vs Relative Paths

      4:50

    • 10.

      Show Hidden Files

      2:52

    • 11.

      Create and Manage Files (touch, rm, cp, mv)

      9:40

    • 12.

      Create and Manage Directories (mkdir, rm -rf, ls -R, cp, mv)

      4:19

    • 13.

      See What’s Inside a File (cat, less, wc)

      5:27

    • 14.

      Write Some Text Inside a File From the Terminal (echo)

      5:28

    • 15.

      Edit a file in The terminal with Nano

      5:21

    • 16.

      Configure Nano (.nanorc)

      3:59

    • 17.

      Create and Execute a Bash File

      5:55

    • 18.

      What You Can and Can’t do as “your user”

      4:01

    • 19.

      Run a Command with Admin Privilege (sudo)

      3:02

    • 20.

      Understand File Owner and Permissions (ls -l)

      5:40

    • 21.

      Change a File’s Owner (chown)

      3:13

    • 22.

      Change a File’s Permissions (chmod)

      7:19

    • 23.

      Install and Remove a Linux Package (apt, yum, brew)

      5:20

    • 24.

      Update Existing Packages (update, upgrade)

      4:44

    • 25.

      Extra: Use Snap on Ubuntu

      3:56

    • 26.

      Find a Specific File by Name (find)

      4:35

    • 27.

      Find Lines Containing a Pattern (grep)

      2:44

    • 28.

      Pipe with Examples

      7:43

    • 29.

      Linux Terminal Shortcuts

      4:33

    • 30.

      Work with Multiple Terminals

      6:12

    • 31.

      Find and Kill a Linux Process (ps, grep, kill)

      6:55

    • 32.

      Monitor Space and Power Usage (df, htop)

      3:57

    • 33.

      Discover Basic Network Commands (ifconfig, hostname -I, ping, wget)

      4:34

    • 34.

      Remotely Connect to Your Linux Terminal Using SSH

      6:02

    • 35.

      What to do next

      2:20

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

459

Students

2

Projects

About This Class

You are learning how to use the Linux command line, but you’re feeling lost?

Or, you’re already a Linux user and want a quick refresher of the basics?

And you prefer to learn by doing, with teaching material inspired from real life experience? → This Linux command line class is for you.

No need to know anything about Linux to get started. I will start from zero and even provide instructions to install a Linux OS on a virtual machine, if you don’t have access to a Linux machine yet.

This class works on any Linux system: Debian, Ubuntu, CentOS, Fedora, and… MacOS! Yes, MacOS is actually based on Linux. The core concepts are the same for all Linux versions, with maybe just a few differences in the commands that I’m going to explain.

→ Why this class?

Well, learning the Linux command line can be quite confusing at best. I experienced that on my own, when I got my first Linux lessons in school. I just didn’t get it, and I just didn’t see the point of using all those complicated commands to complete exercises that I wasn’t going to use in real life anyway.

At first I was lost and kind of demotivated about it. But after a few professional experiences (web/mobile development, server administration and automation, robotics), I started to get a good grasp on the Linux terminal, and more importantly, I started to really understand why I need it and why it’s super powerful. Now, whenever I use a Linux OS, I just remove almost all graphical tools and open the terminal for everything. 

So here, I’ve put all my years of Linux experience into this class, with a strong focus on understanding what you’re doing, and why you’re doing it - basically what was lacking in my own education. 

My goal is that you can get a strong Linux command line foundation quickly, in just a few hours, and maybe avoid being confused for a few months/years before really “getting it”.

This Linux command line foundation will help you for anything IT related: web or software development, data science, machine learning, robotics, system administration, etc. This is the building block you need to go in any other direction.

And there are many things that look fancy but are a waste of time, especially when you begin. So  I’m going to teach you what I really use personally. No need to learn 150 commands to get started. With just a few ones and a good understanding, you can go a long way.

→ How do I teach?

  • Step by step: each section, each lesson, is built on top of the previous one, in a clean and ordered way. 1 lesson = 1 small step towards your mastery of the Linux command line.
  • Keep things simple: as an engineer I know it’s tempting to make things over complicated to show you I know a lot of stuff. My philosophy for almost anything is: the simpler the better. By keeping things simple you won’t feel overwhelmed.
  • Hands-on: no complicated theoretical explanations, I directly write commands and explain at the same time. And I encourage you to also write the commands on your own.
  • To the point: if I can explain something in 5 minutes, I don’t produce a 15 minutes video to make the class look longer.
  • Practical: I teach you what you really need to know about Linux using concrete examples, to do stuff you really need to do. I also give you some additional exercises to practice on the key concepts you’re going to use a lot.

→ What will you learn/do in the class?

First, if you don’t have access to a Linux OS, I will show you step by step how to install Ubuntu on a virtual machine, with a minimal and clean setup.

Once you have your Linux OS ready to be used, we will directly jump in and learn how to:

  • Navigate and understand the Linux file system
  • Create and manage your own files and folders
  • Write into files using a command line text editor (Nano)
  • Change files and users permissions
  • Install and update software
  • Monitor Linux processes and computer resources
  • Remotely connect to a Linux machine using SSH

Bonus: on top of all that, you will also learn how to improve your efficiency with the terminal, using auto-completion, pipes, search tools, keyboard shortcuts, multi-terminal setup, etc.

And I’m going to give you all the best practices I got from my own experience, so you can start off on the right foot.

See you in the class! :)

-----------------------------------------

This class is for:

  • Complete beginners who want to really understand what they do and want to get the “why” behind the Linux command line.
  • Linux users who want a quick and to-the-point refresher
  • Anyone who wants to work in IT, because well, Linux command line is everywhere and you can’t just ignore it.

Prerequisites for this class:

  • A computer and a strong will to learn, that’s it!

Meet Your Teacher

Teacher Profile Image

Edouard Renard

Software Engineer and Robotics Teacher

Teacher

IMPORTANT UPDATE:

SkillShare has decided to remove most of my courses because suddenly you have to be a "Top Teacher" or a "Teacher Corps" to have courses on tech topics. The removal of courses will happen on May 31st, 2023.

This is really bad for me, and I'm also sorry that you won't be able to follow my courses anymore here. This is also going to happen to a lot of other instructors.

If you want to learn from me, I encourage you to find my courses on another platform (I don't put the name here because they probably have a filter that will remove it if they see it.) For this you can just go to my website (robotics backend) and on the "courses" page, you'll have a link with a coupon for all courses.

Finally, with this huge course removal, I don't thi... See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Welcome!: Welcome to this course on Linux Command Line for beginners. You are learning the Linux command line, but you are feeling lost? Or you are already a Linux user and want a quick refresher of the basics? Well, this course is what you need. I'm Edouard, a software engineer, and entrepreneur in robotics. When I first got started with Linux, it was really confusing at best. I remember being in class and just not understanding why I should use the terminal with all those commands, which seemed so hard to grasp. But then after getting some real life experience and practicing and working over the years, I started to really get it and now I use it for any software related projects. So today I have put this goes together to teach you the way I would have liked to be taught. Explaining to you the "why" behind everything you do using concrete examples with a practical mindset and just going to the point, step by step, with hands-on lessons and practice. I have made this course as short as possible so you can learn the basics you really need without all the typical useless stuff. At the end of the course, you will master the basics of Linux command line and you will be confident when opening and using a terminal. From there, you will have a solid foundation you can build upon and use for any project which requires the use of Linux. Learning Linux command line is maybe the best investment you can make right now to progress on anything related to IT and also progress in your career. You have to know that all the big tech companies actually use Linux as a base for most of their products. Note that the course will work for any Linux-based operating system. For example, Debian, Ubuntu, CentOS, Fedora, and also Mac OS. And no need to know anything about Linux to take this course, I will even show you how to completely install and setup you would do on a virtual machine. Now, what will you do in this course? Well, first, you will learn how to navigate through the Linux file system and then how to manage files and directories. How to edit text directly from the terminal, how to set files and users permissions, how to install an update packages, how to monitor processes and resources, how to remotely connect to a terminal using SSH. And that's not all! During the course, I will give you many tips and best practices you can use right from the start. I've also added a complete section focused on how to make you more productive and more efficient while using the terminal, you will have all the tools to become a great Linux command line user. All right, So if you want to learn the basics of Linux command line fast while going to the point weight no more, and let's get started! 2. How to follow the course: Here are a few suggestions on how to follow the course so you can get the best out of it. So first for each lesson, first, watch the entire listen to get a global overview, and then come back at the beginning of the video and write all the commands that I write. For this, use the pause and rewind buttons. It is very important you do that because just watching is not going to be super efficient. Watching end doing is the best thing you can do to learn and understand the concepts and to remember the different comments. And now a few more tips follow the course in the other, okay, because every lesson is built on top of what you have seen before. And then don't focus too much on remembering all the commands with all the possible options, okay, there is actually little value to that. Instead, focus on understanding what you're doing. That's the most important thing at the beginning. Then you can download the PDF, which contains the commands we are going to use in this course. So during the course and even after the course, keep this PDF on the side or just print it so you can change it. Whenever you don't remember a command. Then you will see with some consistent practice after the course, you will finally know all those commands by huts. And finally, one last tip. Don't hesitate to experiment on your own. There is an infinite number of things you can do with a terminal with so many commands and options. So stay curious and try different things on your own. Alright, now enough talking and let's start the course. 3. Install Linux (Ubuntu on VirtualBox) - optional: In this video, I will show you how to install Ubuntu, which is one version of Linux in a virtual machine with digital bucks. If you already have a Linux operating system installed on your computer, this step is optional and you can decide to go directly to the next lesson. But if you don't have Linux installed or if you want to have your own experimenting on environment for the course. And you want to be sure that everything works the same as me, then follow the steps in this video. And later on, after the course, you will be able to change the Linux operating system you use. All the knowledge will have here will apply the same. So first of all, you can open a web browser and just type you want to download on Google and you will get to that page. Okay, you're going to.com slash downloads slash desktop or something like this, okay? And just download whatever is the first version to whatever the recommended version. Okay, So for me that's human to 20.04, I'm going to click on Download. So you wait a bit, you can see this. So you save the file, you save the dot ISO file, okay? And this is quite big, can be 2.7 gigabytes. So depending on your Internet connection speed, that can take some time. And well, you don't need to worry about this. Now, while this is downloading, we can also download and install Virtual Box. So you type VirtualBox. You go on the Virtual Box.org website. And here you don't know that whatever is the latest version, okay, it doesn't really matter. Division just download the latest one and you need to choose which hosts you are currently using. So the host is your environment right now. So I'm using Windows. I click on Windows, NSA, the executable. So now you can wait until the VirtualBox executable is downloaded. And once so once you have the Virtual Box, executable can just click on it, you can just execute it. And that's going to open the installation process for digital books. So just accept everything. Click on Next, okay, you can just click Next, accept things. I'm going to skip that. We should get on the desktop but you can keep it next. Install, yes. And it's cool. You click on yes. If you have a pop-up and that zone sunlight, you can finish the installation if you want to launch VirtualBox. So maybe you will have a shortcut on your desktop or you can just type here VirtualBox and choose VirtualBox here. And that's going to launch your VirtualBox Manager. So here I have a few already existing virtual machines, okay, but for you if it's the first time you install it, well, you will have nothing here. Okay, so what we're going to do, we're going to start by creating a new virtual machine, okay? We're going to configure it while the Ubuntu ISO is still downloading, okay, and I'm going to name it human to 20.04. And I'm going to add Linux command line, cuz you just Use the name you want, okay? You choose type Linux and then version, you're going to choose human to human to 64-bit. Click on Next. It's going to ask you, how much RAM do you want to allocate for the virtual machine? So I advise you to give at least two gigabytes of RAM is you can for, is better, Okay? And I'm going to use six chemicals. They have 16. So I can use six quite safely. If you have eight gigabytes, well, you can go between 24 gigabytes of RAM for the virtual machine. And you go next, create a virtual hard disk now, okay, create, you keep that next dynamically allocated, okay? And then it's going to ask you how much, so how much space you want to allocate for the virtual disk. So basically by default is going to be 10 gigabytes. I'm going to put 30 gigabytes, okay? Because 10 is really quite low. So Create. And now you have a new virtual machine here, which doesn't have the ISO yet. And I'm going to go onto, you select this one and you click on settings. Okay, we are going to finish the configuration you will on system. So you have, you can see the running shoe on to chain the RAM at anytime. You can change it there and you go on processor. And this was not available for you in the startup process, okay, but this is quite important also. So by default, your virtual machine, we only get one CPU. Thing is that you maybe want to increase that because one is going to make the virtual machine quite slow. So in my case, I have four CPUs, which are quite powerful. I'm going to put two of them. And if you have eight CPUs, you may be want to put three or four CPMs, okay? So now I click on Okay. And now let's see if you went to ISO has been downloaded. Yes, it's here. And so the human to ISO is on my computer, so on my downloads folder. So it can be whatever folder you have selected for the downloads. And then you're going to go back here to the settings of your virtual machine and go on storage, okay? And here you should see controller ID and empty. So you click on empty and you're going to choose here, click on the disk icon, and you're going to choose a disk file here. And then you can just select the ISO you have just downloaded. So now you should see the ISO name here. You click on, Okay, and now, Well, you can just start the virtual machine. Okay, So you confirm this. Actually, I have that one, so I have downloaded to ISO. You continue with start and then you can see it's going to boot. And you know, in the installed menu of humans. So you can just click on Install Ubuntu so you choose the language you want here. Install human to a monarchy, English of course. And then you choose the keyboard layout. You have this, I don't have the QWERTY keyboard, so I'm going to change it there to French. Let's test. Okay, Continue. And so here if you want all the utilities and stuff you can keep know amongst deletion. But I'm going to go with the minimal installation because we don't need that much actually for the course. So you can check here, download updates, yes, so you click continue. And then it will ask you if you want to erase the disk and install, you went to an actual, you are going to say yes to that because you're actually not going to erase any disk. This is only the virtual disk that the virtual machine has created for you. Okay? So no problem with that. So you click on Install Now. And then you click on Continue. Good. You select your country, your time zone, whatever, Continue. And then you are going to put your name or just the pseudo you want. So I'm going to put, Add and choose a computer name. I'm going to add dash V M for virtual meshing. So here you choose whatever you want. Don't put any space in it, okay? And best practices just to keep it short. Okay, you will see later that just to keep it short, so that's going to be better. And then choose a password so, well, because this is a virtual machine inside my windows, I'm going to keep very simple password and login automatically so you can put a stronger password if you want to here and click on Continue. And it's going to finalize the installation of human too. So now you can wait a few minutes until this is done. Okay? And after a few minutes, you will get to that step installation complete and you can click on restart. Now is going to risk at human do inside your virtual machine. So here you can press on Enter. All right, and you can continue the final steps. You can send R, don't send information to the company who made you want to, as you want next, next door. And you are now ready to use human to. Just one more thing is that you can see that if I put my virtual machine full size, okay, full-screen, well, The, you're going to, inside it doesn't resize automatically. And to do that, so maybe you will have this problem. If you have this problem, I'm going to show you the three steps solution so we can correctly have the, you're going to full size. So the first step is actually, so you're going to click here, you're going to type terminal. I'll just find the terminal. So actually we are going to use the terminal in this step. And if you see that software data, do you want to update? You can say, remind me later, okay, we're going to see that in a future section of this course so we can continue like this. No problem. Here. What you're going to do, you're going to do sudo APT. So just type the command. Okay, you don't need to understand that. I'm going also to explain that later. This is just for the configuration of the virtual machine. So you do sudo APT install GCC, DK, S. So you type exactly that, you press Enter, okay, you need to provide your password. Okay? You won't see the password. I mean, you won't see any text when you type the password, just type the password and press Enter. Okay. So you're gonna see a lot of stuff and then do you want to continue? Yes. No. So you have to press Y for yes. And then Enter. And it's going to install, so it's going to install some packages and willing to explain that later in this course. Okay, but just we need to do that actually if we want to be able to have human tool to resize automatically. Okay, and what do you see that when you're back to the green stuff here in the command is finished, you can close that, okay? And I'm going to go here on devices, okay? So in the virtual machine window, and you're going to click on, Insert, Guests, additions, see the image. And then you click on around. Okay, you put your password again. Okay? And once you see that, press Return to close this window, so you press Enter. And what you can do now is you're going to click here To power of the machine. So Tupperware has the machine, you actually have two options. You click here on the virtual machine window power of the machine, okay? And you can also click here inside the Ubunto operating system and do power off, then pour off. And Poor's. That's distinct thing. Okay, so now you have pulled off your virtual machine. I'm going to go back to my VirtualBox Manager and launch the human to once again. And here, well, the thing is that it's working, okay? So you need to resize the window and you want to resize directly inside. And note that on some occasions it was not working the first time, so the window was still small inside the virtual machine. In that case, what you can do, and this is step 3, which is optional here if it's working now, you click here, ejects, get a disc. You click back on devices. Instead, guest additions to the image. And you just, so you just click on Run again. Okay? And then you press Enter and you reboot the virtual machine once again. And that should be okay, and it should work. And then at the end you can go back here and right-click edge. Okay, great. So now you have a working environment with everything ready for you to use. The terminal. 4. Open a Terminal: And the first step to actually be able to use command line tools on the terminal is, of course, open the terminal. So I'm going to show you different ways to open a terminal. And some of them here are specific also to a Ubunto. So depending on your operating system, the interface would be different, but at the end you will find the terminal. So first you can click here. You may have stuff like applications like that, activities, okay? And so you click here and you have a search bar and you can just type terminal, terminal or maybe CMD command. It should bring you to the terminal. So you click here and you have opened your terminal. So that's simply a window, okay, That's a window with the terminal inside. If you want to close it, where you close the window, that's it. Now. And this is a shortcut that is going to work on human too, and maybe not on other operating systems. You can also do Control Alt and T. This is going to open a terminal. If you want to close it, Control Shift and q, and you close the terminal. So I'm going to go back here and I'm going to search for terminal. Okay? What you can do now you can see on the left, so I have a bar with applications. I can right-click here, Add to Favorites. So now when a closet, it's still here. So I can directly studied by clicking on this. And if I want, I can open different windows, okay, I can open as many terminal windows as I want. I'm going to clean up that. I don't need this alone in this. I'm just going to keep Firefox five and terminal here. All right, and in the terminal, so that's also maybe specific to you will do, you can right-click preferences, okay, if you want to change some options and maybe the size. So I'm going to put the size here for me to 16. Select. Okay, So that would be more readable for you when I type commands, protocols. And well now you are ready to use the terminal. 5. Navigate in the Terminal (pwd, ls, cd): Let's start right away to use the terminal and not waste any time. So open a terminal, okay, if you don't know how to do this, please check one of the previous video where I explained the different ways to open a terminal. And now in that lesson and the following ones, you're going to learn about the Linux file system and start to play with a few commands. Through experimentation, you will see how to navigate inside the file system, understand how it is structured and what are the most important folders we are going to use. I will also give you the first tips and best practices you can apply when using the terminal. Let's start with the navigation as a first step. So in the terminal, the first thing you can see here is that so on you would do I have this which is in green, you have the username you have chosen here, which is aid for me. And then add and then the host name of the machine name, so which is added dash Vm for me. So that's the first thing you are going to see. And then you are going to see something in gambling to come back to that. And then a dollar, and then you can type some common here. Now, I'm going to open a file manager on the side. Okay? So if you don't have this, you just go here. You can just type files and you are going to find a file manager. Okay? So I have my file manager here, and by default you are. So you have a home directory, the home directory for your users or for the user end. And in that directory you can see I have Document Downloads, Music, etc. Now the first command we're going to use in the terminal is the command L S is true. You just type L S like this. And this is going to list all the files and folder where you are currently in the terminal. Okay, so you type LS in, press Enter, and you can see, well, that's the same thing. Desktop document, download, music, etc. Okay, we have the exact same thing. And this is because in the terminal, it's just like you are browsing your file manager, but we're just a different view, okay, here you have a window and you can see folders, images, okay, for the folders, here you just have, well, you just type ls and you have the list of all folders and files in the directory you are currently in. So that's the same thing. If I create here a new folder, for example, let's say my folder don't put any space in the folder name, create. I do. Ls. Again. You can see I have my folder, okay? So this, and this is the same way. So ls, ls you can list all files in the current directory. Now, if you want to know exactly where you are in the current directory, you can use the command P, W, D, which is printing the working directory. You press Enter and you can see we're currently in slash home slash paid. Okay, I'm going to come back to that a bit later. And well, if you go here, so you have home, but if you press so you click on the File Manager and you can do Control L. So this is specific to you go into here and you can see the real path. The real path is slash home slash edX. This is the same. Okay? So now that you have seen that basically working in a terminal with file and folder is the same as working in the file manager. Now the only thing that is missing, well, so we can list five, we can see where we are. And now what is missing is, well, how can we navigate between different folders, okay, if you want to go to the Documents folder in the file manager, when you double-click on this and you are in the document folder. If you want to go to the document folder from the terminal, you are going to use the command C, D. So you're going to see and not only city, but then you are going to provide the name of the folder you want. So DO comments. You press Enter, and now you are in documents. You can see the blue stuff here has changed to kill the slash document, okay. Till the actually means home directory. So slash documents, you are in the same folder as here, and then you can do LS. And now when you do ls, well, you have nothing. Why is that? Because, well, there is nothing in that folder. The folder is empty. I'm going to create a new folder here. It's a test. Okay, Now I do ls and I can see tests. I can do CD tests. And I am no in the test directory, if I do PWD, I can see I am in slash home slash slash Documents lashed tests. Okay. Which is the same as here in the text. Now we've CD so you can go forward. You just need to give the name of the folder. You can also go backwards. You just do dot dot. So cd dot dot is going to go back one folder. So now you are in document, cd dot dot NUR, back to your home directory. And now if you want to go back to dest folder, instead of doing cd Documents and then C-D tests, you can do directly cd Documents slash tests. And in just one command, you are in the test folder. If you go back to home here, you need to first go to Document and then test. So you have two steps here, you just have one step. Ok, and now from there let's say I want to go to my downloads folder. Well, the download is in the home directory so I can do CD dot-dot slash, dot-dot, dot-dot. We'll go back to document another dot-dot. We'll go back to home slash downloads. And I am in my Downloads directory. So go back here, go back here, downloads three steps in just one command. And lastly, if you just want to go back to your home directory, so to the home from anywhere, you just type cd without any parameter, city and boom, you are in your home directory again. Alright, and in the next lessons I'm going to show you the different folders and how the file system is structured and also give you more information about that specific home folder. 6. Tips: Autocompletion, History, Clear the Terminal: Now that you have used the terminal a bit and you have seen the basics of navigation and three commands. I'm going to give you some super useful tip you can start to use right now. And those tips will make your life much easier. So first of all, when you are in the terminal and if you just want to get rid of everything and get a fresh view of the terminal. You can use the command clear, like this, Clear Enter, and you just empty everything that was on the terminal. So that's very useful when you want to have a clear interface. Then, and that is the most important tip is you can use auto completion. So what do I mean by auto-completion? I'm going to do ls to list the files and folders. And now let's say I want to go to my folder so I can do CD, My Folder. And I'm in my folder, I'm going to go back with city to go back to the home directory. Now if I do cd m and I press tab, you can see when I press tab, I directly have my folder which is automatically completed. And this is super, super useful. You are going to use that all the time. So for any folder, any file, any comment. So anything in the terminal, you can just type the beginning of the world and then tab and it's going to autocomplete it if there is one possibility. Okay, now, let's say I do CD D and then so d uppercase and then tag, well, if I do tab there is nothing. If I now do Tab twice, you can see that I have a list of suggestions. Okay. Why is that? Because, well, simply with d uppercase here, it's not possible for the terminal to know what I want to do because we have three folders studying with D Desktop Downloads Documents, but you can see them here. So I need to provide a bit more information, let's say iPad to 0. And I press Tab again, nothing happens. So I press Tab twice. I have documents download because now with DOI have documents and downloads who starts with the same letters. So if I want to go to downloads, for example, I'm going to put DOW tab NIF downloads. I go back, I can see Doc tag documents. And now if I press Tab once more, you can see I have test. Okay. Why is that? Because simply in the documents folder for now we just have one folder test. So there is just one possible option. And if there is just one possible option, that's the one that will be kept with the auto-completion. So you can see it's very fast. If I want to go to document text, I do CD, D, O C, tab, tab, enter. If I want to go from there to download, I can do cd dot dot slash dot, dot slash DOW tab. And that's it. So I'm going to use auto-completion a lot in this course. And I encourage you to do the same whenever you type some comments just like the beginning, and just try to use tab. And this will save you so much time. And one more thing is you can use the history. So when you write some comments, there are going to be saved in history. So you can use the up and down arrow keys. So if I use up keys, you can see I have the comment I have just run before. If I use up again, you can see CD document text. Again. I have the city that I have used here. Okay. And then once more cd my folder, once more, Ls, okay, I use the bottom row. Okay, I can go back and I can just browse the different options that I had. So let's say from the document. So let's say from the downloads, I'm going back. So I do cd dot, dot slash dub, dub to go to the test. Now let's say I want to go back to download. What I can do is directly press the up arrow twice. To go back to this comment, I press Enter. Okay, If I want to go back to the test folder, I press twice Enter. And if you want to have the list of arguments you typed, history, Enter and you can see all the history of all documents you have written. All right. And now let's I want to clear interface. I do clear again, and I'm still in my test folder, but with nothing on the screen. So to recap, you have seen here the clear command. You have seen the autocompletion and how to use the history. Those commands are going to make your life much, much easier when using the terminal. 7. Linux File System Overview: As for now, we have stayed in the home directory of your user. So for me that's the user to go to the home directory. Once again, you can do just city and you are in the home directory with tilde. Okay, in the fund manager, that's the same. And now let's do cd slash. If you do cd slash, you see that, you know, have a slash here. And once you do ls, you'll have a completely different set of files and folders. And on the File Manager, well, so he on Ubuntu, I do Control L. I have slash home slash edX. I'm going to remove that and just good to slash. And what's more, you can see that this is exactly the same. You have the same names here, same folders as in the fund manager. And this is actually so this is the main computer in the PHY manager and this is where the roots of your file system. So only nukes by default. You have just one partition, the partition stats. So the path, we start with a single slash like this, that's it. And then everything will be under that slush. Like on Windows. On Windows, you have, you can have different partitions. For example, you are familiar with the C partition. You can have a, D, E, etc. And so each partition on Windows C, D, etc, will be completely separated. Here on Linux, everything starts not with a letter, just with a slash. And then you have many different files and folders. Everything is here. You have nothing behind the slash, okay, this is the starting point of your file system. Now, well you can see we have quite a few folders here and phi's. And you don't need to know the meaning of each folder to really get started with the terminal and the common lines. I'm just going to give you a very quick overview here. So for example, you have a boot folder here you can see the boot folder. So this is where you can find stuff needed when the Linux operating system boots. On the dev folder which is here. Here you are going to find the devices you can use. For example, if you connect a USB key on mouse. So the device will be listed here occasionally do cd ls, you can see a lot, a lot of stuff, so you don't need to worry about that now, I'm going to do cd dot dot to go back to the roots. So on the roots, actually on the route directory, you have the home directory for the root user. We're going to see more about the root user later in the course. Okay, So don't mix the root here of the file system and the root user, which is basically the administrator for the machine and then on the users. So here you, as a user, you have programs, libraries, et cetera, that can be used by users on the operating system that you go on. Slash user ls. You can see we have, for example, bean and in-between you can find many of the comments that you are using, for example, PWD, etc. And then on the slash OPT, you can find some extra software okay, from third party vendors, for example. And when you have many other folders, but I'm not going to list and tell the functionality is for everyone. You really don't need actually to know that to get started with Linux and the common line. As an analogy for that, Let's say you are learning a new language different from English. And the first thing you teacher gives you is a list of all the names for all kinds of shoes you can find in a shoe store. Well, that's not as useful as learning how to introduce yourself and ask directions in the city, for example. So that's the same thing here. Understanding what the file system is, starting with a slash, okay? This is the root of the file system. Then you have a bunch of folders and files for different purposes, okay. For system purposes, for user purposes, to install software, etc. And when the time comes, you will be able to get to know more about each directory, okay, one by one when you actually need to use them. 8. The Home Directory: Out of all the directories we have here at the roots of our file system, there is one which is super important and that you are going to use a lot, not only for this course but for anything you will do with Linux. And this is the home directory which we actually already used before. So if you go home, you can find a territory here with your username. So add for me. If you have different users, you're going to find different folders here, one for each user. And if you go to add, well, you just go back to the home directory we had previously. Okay, so we're going to do the same thing in the terminal. So I'm going to clear, I'm going to do cd slash ls. You can see we have the 0 and in the home we have eight. Okay, I do add and then I'm back to my home directory. And as you can see, instead of putting slash home slash L here, it's going to put tilde, which is the exact same thing, PWD slash home slash pattern. So now you know, where does this come from? From the root of the file system, you have a home directory. Inside the home directory you have a dormitory for each user. And then once you are connected as a user, so the user head, right now, I go to my directory, and this is my home directory where I can see a til the end. This is where I'm going to work most of the time. So all the files you're going to write and modify all the configurations which are specific, not to the system but to the user head. I'm going to be in that home directory. Okay, it's kind of similar to the Windows home directory. If you know a bit about Windows, you have, for example, a user's directory. And then for example, if your user is add and you add in edX, you also have a download Document, music pictures for the etc. so that's kind of similar and you usually put all your files in Windows in your home directory. And so to go back to your home directory at any point, I have already showed you you can use the command C. So if I am in slash, okay, if I am anywhere, I can just use CD and I am going back to my home directory, so that's very useful. 9. Using Absolute vs Relative Paths: There are actually two ways to represent the path to go somewhere in a folder or file. The absolute path or relative path, okay, and fauna, we have mostly used the relative path. So relatively simply, where is a folder relative to where we are right now? So if you are in your home directory and you want to go to downloads, you do cd downloads from there. If you want to go to Documents, you have to do cd dot dot slash documents. So this is relative to where you are when you execute the command, okay, if I do cd documents, so I use the up key. If I do, sorry, cd downloads, I press Enter. Well, no such file or directory because now I'm in documents, I'm not in a home directory. Okay, so the relative path only works from one specific place. Now, if you want to be able to get the correct path from everywhere, you need to use the absolute path. And the absolute path is actually by using cd slash. So you're going to start from the root of the file system. If you want to go to downloads, you're going to do cd slash, home slash, the name of your user, slash download. And you can use the auto-completion here. Okay? And this is going to go to downloads. And it doesn't matter where you are when you execute this command is going to go to downloads anytime, okay? And you can see here actually if you type PWD, We have the exact path. So you have the absolute path for one folder. So let's say for example, I want to go to cd slash. So I can press Tab twice to see the list of options. User slash B. I am in users slash bin. And now I want to go back to my downloads folder from my home repository. I just go back to cd home aid downloads and I'm in downloads, and I go back again in user bin. So very useful to use the absolute path in that situation. And one thing you can do is instead of slash home slash aid, as you could see, we have a TLD, so you can use the TV if I do CD till the dash downloads, till they will be replaced by slash home slash eight. So you can just write Tilly if you want to end here, I am back to my downloads folder. So this command, and this command is the exact same command. Okay, So now just as a quick exercise, what you can do is from that download folder you can try to go to. So I'm going to use the File Manager here. You have a documents folder and you have the test folder. So I challenge you to find as many ways as possible to go from the downloads folder to the test folder of the documents folder. Okay. So you can pause the video and once you have tried different ways, come back to the video and I'm going to show you now different ways to navigate. So first I'm going to clear, Okay, we are in the Downloads and we want to go to the test folder. What I can do first, I can do cd dot dot to go back to the home directory, cd Documents, city tests with autocompletion, and I'm in the test folder, I'm going to go back to download. What I can also do is instead of cd dot dot, I can use city directly and then go to documents may be used at the completion tests. Okay, So sometimes in real life that's quite practical to not give just one command, but just to do city. Very fast. You are in the home directory and then city and then use the auto-completion to go fast into where you want to go. I often use this combination. Well, let's go back again to downloads. You can also do cd dot dot dash documents, best grades. Let's go back to download. If you want to use the absolute path, you can do cd slash home. You can see H tab and then Tab again because you just have one user here. Documents, tests. Great. I'm going back to downloads or you can do cd tilde slash, docx, dab, dab annual back to document slash tests. Okay, so here you can see, well you have multiple options, whatever you want to go somewhere and you can use the absolute path with just one command, or you can use the relative path. And if you use relative path, you can also splits the commands between different kinds. Sometimes it's faster. So just depends on where you are, where you want to go. With practice, you're going to be better at this and choose the best option to go faster. 10. Show Hidden Files: And one more thing I want to show you before wrapping up this section is that, Well, there are actually many more files that you can see on the terminal and on the File Manager, okay, and those are hidden file. So I'm going to go back to my home directory. We've just city and clear. So if I do ls, I see I have those folders here. I go home. Here I have those folders. Now if I do ls and I add dash a is whenever you have a comment, you can also add some arguments to the command. And to add arguments you are going to use dash and then you're going to use some letters, okay, So a means 0. So ls dash a is going to list all the files and folders in that directory, including the hidden files. And as you can see, we have actually quite a lot. So the folders here are in blue, okay, the files are in white. Doesn't matter whether it's hidden or not hidden file, okay, you are going to see blue and white in human too. And then you can see we have a dots. So some of the file and folder starts with a dot. And this means that those are going to be hidden files that you are not going to see just with ls. With a file manager. You need to do ls dash. And actually in the fund manager, you can also find here show hidden files. And boom, you have all the hidden files which are exactly the same as you see here on the terminal. And now those files and folder, any special well, actually no, those are just standard files and folders. Just that there are hidden because you put a dot in front of the file and that's it, the way you are introduced those folders and those files is the same as the way you are going to use any other folder of files. So for example, you can do in CD dot local, so you press L and in town, and you are in your home directory, slash dot local, okay, ls, cd share. So you can continue to go inside that folder and maybe you can explore the different folders you can see here. Okay, Great, So we have just finished the navigation and the file system parts of the course. So as you can see, everything is a fight or everything is a folder and Linux, some of the fights are hidden. By default. You can navigate with the ls and the cd commands, and you can see where you are right now with the PWD command, you have the root of the file system, which is just slash. And then from there you have different folders and you have the home folder. And inside the folder with your username, which is the home folder you are going to use for all the work you are going to do in the future. 11. Create and Manage Files (touch, rm, cp, mv): Great. You now have a global overview of the Linux file system. You also have made your first steps with the terminal, and you can navigate in the file system using three simple commands. So navigating and seeing what files and folders you have is cool. But now, how can you actually create files and folders? How can you see what's inside a file? And how can you modify a file? That's what we're going to see in the next few lessons so far guys are super important. Why is that? Well, all the configurations, all the code, all the programs, everything in Linux is a file. A folder is a specific type of file which goal is to contain other files. You can have different files for different purposes and as you can see before, you also have hidden files. So I'm going to repeat it here because it's very important in Linux, everything is a file. So let's start with this lesson where you will learn how to create and manage phase. Note that here we are going to work in your home directory. So you can do as CD, go back to your home directory because that's mainly where you are going to create files in the future. And so the first command you're going to learn to create a file is the command touch. So you use touch and then the name of the file you want. So I'm going to name it test file like this. And I press Enter. And now you can see ls. I have testified in white here. If I go to my file manager in my home directory, I have the test file. Okay. So I think now you understand the relation between the terminals of what you see on the terminal and what you see on the PHY manager. This is distinct thing, so I'm going to close that and continue with the terminal. Now, just a few rules and best practices for the name of the file. Okay. You have seen I have used a dash here. I have used underscore for this folder, so I can use a dash O underscore to separate words. Dash O underscore is fine, but what is not fine is to use spaces to separate worlds in a filename. This is quite common on a Windows, but actually that's a very bad practice to do, especially here on Linux. And for example, if you just want to do, for example, touch test file like this, what you're going to do is new, not going to create a new text file with that name. You are going to create two new files, the five tests and the file, file. Okay, so remember when you create a file and you have multiple worlds, separate them with a dash or an underscore. Now when you have the touch command to create a file or you can see you can create multiple fight, okay, you just use touch via number one, number two, number three, et cetera, separated by a space. Now if you want to remove a file, so that's the opposite command. If you want to remove a file, you have the command Enter I M and the name of the file. So if I want to remove the file named tests, I do RM test. I press enter ls, the five is gone. You can see the fight dest is gone. And you can remove multiple files at the same time. You can do horizontal phi. I can use the auto completion. So our EMF, which is going to do file and then T Dub, I'm going to remove the filename file and the file name test file. I press Enter and you can see everything is gone. So you have touched to create a file, RM to remove a file. Now I'm going to show you something is that if you don't know exactly how to use a command, if you need more documentation or you want to see more options of what you can use. You can actually use the command man, which is the command manual. So you use man and then the name of the command you want. So man, RAM or your bowl. You press Enter and you're going to get to a page like this. You can see name are and remove files or directories. Okay? And so you can scroll with the mouse, are also with the keys of your keyboard. So you have a name and description. You can see the different options you can use. We are going to come back to that later. Okay? And if you want to quit, the help, you can see here, you can press the Q T of your keyboard. Just press the Q when you are out of the manual. So you can use this with any command you want. Now, I'm going to create the fight against touch tests. I'm going to use an underscore here, that test file and test pilots here. One thing, one very important thing also is that you can see I don't have an extension here. So if you want a file which is going to contain some texts. Again, usually, for example, on Windows to add the dot TXT extension. So I could do touch test file.txt a, which is going to create a dot TXT file. But on Linux, well, it doesn't really matter. So sometimes for some applications, you are going to need to put a specific extension. For example, if you want to create a Python file, we are not going to see that. But if you want to create a Python file, you are going to use a specific extension. But basically you have to know that a file without an extension is completely 100% valid. Now, what if you want, I'm going to clear the screen and ls again. What if you want to move a file somewhere else? Or what if you want to rename a file? So I have my test file, let's say I want to put my test file into my folder. What I can do is I can use the M V command. So I use envy and I need to provide two arguments here. First is the file I want to move. So this is debt file. And then where I want to put it in my folder. And I use the auto-completion here. So I want to move the testfile inside my folder. I press Enter, this vine is gone. I go to my folder, ls. I can see the testfile is here. Now what I can also do when I move the file is I can rename the file, or I can just rename the file without moving it. So I use move again with testfile. And what I can do is I just give it a different name. So let's say difference, fight. So I move the testfile two different phi know if I do ls, you can see the test file is gone. Actually it was moved to different file. It was actually renamed. Okay, I can put it back to my home directory so I can do the different phenomenal. And the thing is that I can also use an absolute path if I want. Okay? I can use slash home slash edX, which is going to go to my home directory. And for example, slash document. Or I can also use, as you can see before, till the slash documents. This is going to move this file inside this folder with the absolute path. And let's say you want to also rename it at the same time. I'm going to put it back to tests file like this. I press Enter. And now if I go to my documents so I can do directly city till the slash documents, ls, I have test file here. So NV to move a file or to rename a file out to do both at the same time. And finally, one command you need is, let's say I want to make a copy of that file. Okay? So if I want to make a copy of that file, I use CP for cookie. You can do man cd for example, copy files and directories. And you can see here the description. It's going to copy the source to the destination. And you have CP, so you can use different options and then you need pride, a source, and the destination. So I'm going to do cp. What is the source? The source is testfile. Destination is, let's say another file. This is going to copy this into this. I press enter ls. I have no another file which is an exact copy of the test file here. And of course, I can decide to do, for example, CP best file if I want to put a cookie but directly put it inside my home directory, I can, for example, do dot, dot, dash. Yet another, fine. And I press Enter. And now if I go back to my home directory, ls, I have yet another fight here, which is the copy of the text file from the Documents folder. All right, and now let's clean a bit. I'm going to remove the other thigh here and yet another face so I can do RM. So I am in my home directory so I can do yet another file and I can do document. Another fine. This is going to remove both files. So no ls. I go to document and the file, both files are gone. Okay, so now you can create files, you can remove them, you can move them, rename them, and copy them. So basically you have all the tools you need to manage files in the terminal. 12. Create and Manage Directories (mkdir, rm -rf, ls -R, cp, mv): Working with directories is very similar to working with files, just with a few differences in the comment we are going to use. So we're still in the home directory. I have those files and folders. Now, if I want to create a new directory, I'm not going to use touch, I'm going to use MK II. So make directory basically and then provide the name of the directory, let's say dear one. Unless I have a new directory, dA1. And now I can go inside that directory, PWD slash home slash slash D1. I'm going to go back if I want to remove that directory. So let's write our m, the one. And you can see it's not working. What you need to do is to do em dash r. So this is basically the recursive option for D01. So if you want to remove directory RM, dash R, and this is going to remove DEA 1. Now what if I want to create multiple directories at the same time, Okay, if I want to create DR1 and inside this day or two, and inside this div, three, etcetera, etcetera. And I'm going to do MKDIR three or more times. What I can do is MKDIR D1 slash to slash the three, okay? Now if I just press this, I'm going to have an error. Okay? You can create multiple directories like that. You have to use here. Dash p, Okay? So MKDIR, dash p and then all the directories you want. And then you can see I have d1 inside D1, D2, and then I have D03, and that's it. And PWD, you can see the complete path. Now I'm going to buy just one directory here. So if I want to move out to rename a directory, while here the command is exactly the same as 45. I'm going to do envy and then provide the source. So the source is dear three and then space and then the destination. So let's say I want to move this inside the DR1. So I'm going to do for example, dot-dot-dot. Okay? I can do till the slash dir one. If I just do this, the deal three is going to go inside the deal one, what I can also do is to rename the D03 at the same time, Let's say Deal. So I press Enter, and now, so the deer three is gone. If I go back one directory, I can see now I have 24, which was the deal three, right here, which was no moved and renamed at the same time. Alright, so go back to the home directory. If I do RM dash R, d1, this is going to, as you can see, remove d1 and everything inside D1. So the DL2 and the deal for are also gone with that. So here pay attention when you use that command, okay, because when you are going to remove the directory and everything inside, okay, So make sure you don't remove files that you want it to keep. When you use the RM command. This is going to remove the file and it's going to be very, very hard to find it back then. Okay. So when you remove stuff mixture that you previously checked, what's inside. And we'll finally one more thing is that same as for the file. When you create a name for directory, you are going to use underscores or dashes, two separate worlds, okay? If you want to have multiple worlds in your directories, don't put any space in there. And so now for example, if I were to create a new folder and a file inside this. So let's say I want to go to my folder. I have nothing. I can create. For example, a MK DIR, my other folder. And then I can do touch my other folder, my file. And now in my other folder I have 15. So I just create one folder, 15. 13. See What’s Inside a File (cat, less, wc): And now that you have seen how to manipulate files and folders, Let's see how to see what's inside a file, okay? So a file will contain some texts, will contain, some programs, will contain well-formed configuration, whatever. And from the terminal, you are going to be able to directly see what's inside the fire. And so as for now, we haven't created a file with text. So what I'm going to do is I'm going to show you how to download an existing file containing text. And then we're going to use that for the next explanations. So you can open Firefox here are any web browser, and I'm going to use the GPL license text file. So you can just take that on Google. Find this. So this is a simple text file located ends with TXT. As you can see, that you are going to be able to download the news on Linux. So you have the URL here if you want. And I'm going simply to copy this. So Control C. And I'm going to go back to the terminal. I'm going to use w gets. So actually first we are in the home directory, I'm going to go to Documents. Okay. We're going to put that in the documents. So W gets is going to get something from the web. And then you can paste the UI. And actually to paste something in the terminal, you are not going to use Control V. You are going to use control shift and V, it because Control V doesn't work. Usually to copy and paste stuff, you use Control C and Control V. Here in the terminal, that's going to be Control Shift C and Control Shift V. So you just do W gets Control Shift V, that's going to put the URL, you press Enter, okay, and then you see that unless we have a new file, GPL three dot TXT, and as you can see, this file doesn't have any space, okay? They have dash and then dot to separate the different worlds. So now I'm going to close that and let's go back to the terminal. So now we have a file which contains some texts. The first command to actually see what's inside the fight to print the entire file on the terminal is the command C-A-T. C-a-t. C-a-t. You can do G and then tag. You don't need to write name, just use the auto-completion gut and the name of the file Enter. And you see that you have the anterior fine here printed on the terminal. He is quite big. But that can be quite useful when you just want to see what's inside a file. They just do cat name of the file and you have everything printed in the terminal. Now, if you have a big file like this, it's a small phi, just a few lines. Well that's quite convenient if you have a big file and you want to start reading from the beginning and be able to just kind of scroll into the file. What you can do is use the less command, less, and then the name of the file. Same thing. You press Enter and you're going to get to that view. You can see here this is the beginning of the finer. And you have here Crusoe. And you can actually use the arrow keys up and down to actually scroll inside the file up and down. So I'm going to go back to the beginning. And you can also use if you want to enter 19. And if you want to just crawl one competent screen, you can use space. So space, you can just read all that once you don't space again. And then you can just go to the next block of the text. Okay? You can continue to use space, okay? And if I keep pressing on space, okay, It's going to scroll all the way down and you can see we have end. So here we have reached the end of the five key donkey. Okay? You can go up and down. And if you want to quit that new, you simply press the Q key on your keyboard, q ns it, so less, you press Q and you quit. So those are two ways to visualize what's inside the file, which are very useful. So cats, it's better for small files and less when you have a video file and you want to be able to scroll inside the file. Now if you want to get some information. So that's a bonus for this video. If you want to get additional information about the file, like for example, how many lines, how many worlds inside the file you have the WC command, WC, and then the name of the file. This is going to give you three numbers and the name of the file. What are the three numbers? Well, man, for manual, WCC, enter. What do we get? Wc print, new line world, and byte counts for each fire. So newline world and by count, I press Q. So we have 674 new line, or basically we have 674 lines inside this text file. We have 5,644 worlds. And then this is basically the size of the file, okay, so 35 kilobytes or something like that. And so this can give you a quick overview of, well, how big is the file. And then you can use cut unless accordingly. 14. Write Some Text Inside a File From the Terminal (echo): And now where you can read a file, can see what's inside the file. The next question, now the next logical question is how to write inside of five. I'm going to show you a very quick way so you can add some texts directly inside the file from the terminal with just one command. Because I'm first going to clear, we still have the GPL text here. And I'm going to introduce you to Newcomen that the command is equal. So ICO, and then you're going to use double-quotes. And you're willing to put some texts, for example, hello. What, what's going to happen if you press Enter is that whatever is inside those quotes is going to be printing here on the temple. So ICO, well, basically just Eco's, whatever you put here. Now what does it have to do with writing inside the file? Well, here the result of that is going to the terminal. What you can do is you can say, I don't want the result of that to be printed on the terminal. I want the result of that to go inside the file. So let's see first what we have in our test fire gut tests. Well, the file is empty. Now I'm going to do echo hello world. So I use the up arrow to come back to this. And I'm going to add an angled brackets here, which is going to the right and put the name of the file best finite. And as you can see here with the autocompletion when no duty, it first goes to test because we're actually we have a test folder and testfile. So it just auto-completes what it can auto-complete. And then if you want, you have to provide the additional underscore so that it knows with another tab, it has to go with text file. I press Enter and no cut tests file. You can see we have helloworld in testfile. Now I'm going to go back to that command. What you can also do is to create directly file. So let's say we want to create a file named hello dot TXT. Okay, I want to create a file with an extension. This file doesn't exist. But if I press Enter, now I have hello.txt, which contains Hello world. So with this, you can create a file and put text inside a file at the same time. I'm going to come back to that command and I'm going to run this. I'm going to add tests now to the same fire. Hello.txt. I press Enter and no cat. Hello.txt contains test, but where is the helloworld? Well, the thing is that when you use a single angle bracket, It's going to open the file. So first is going to create the file if it doesn't exist, and then open the file, It's going to truncate the file. So remove all the texts and put the new texts here instead. Now, if you want to not do this, but if you want to just append the text to whatever was there before, you simply need to add another angle brackets. So two angle brackets, I press Enter and I do cat hello.txt. And I have tests, tests. I'm going to go back once more to Hello World. I press Enter and no cat, hello.txt. Actually, I forgot to use the double angle brackets here. So now if I did this and I use the double bracket, and let's add another test. So no kept. Hello.txt contains Hello World, hello World and tests. And now as an exercise, what you can do, what I challenge you to do is to add a new line at the end of the GPL text you have downloaded previously. So you can pause the video, try to do this, and then come back to the video. And I'm going to show you the solution right now. So if you want to add a new line to these texts, you can do equal. Let's say this is a new line at the end. Other factors, for example, you are going to use the angle brackets, but not just one. You are going to use two angle brackets. You just use one that's going to remove all the texts from the file which you don't want to do. So ego, some texts, angled bracket, angle bracket, and then GP, I can press tab. As you can see, it's going back to new line because the space here is used. But that is the same line. Okay, you don't need to worry about that. You can continue to write some comments here. That's not a problem. So I'm going to add this to that file. I press Enter. And now if I do cat GPL, that TXT, I can see. So I'm going to see the end of the file. And you can see here after the URL, we have, this is a new line at the end of the fire. Okay, if I do less GPL and if I continue to go to the bottom with the space, I can also see the last line here. I press Q to exit. Okay, so in the last few lessons, so in this section, you have seen how you can create, how you can manage files and folders, how you can read the text inside a file, and how you can also add some texts very quickly from the terminal. 15. Edit a file in The terminal with Nano: You can now create and manage files and folders from the terminal. You can see what's inside the file and add some text to it with the ICO comment. But now, to get to more sales stuff, you need a tool to be able to do more than just add some texts at the end of a file. For example, what you need is basically a text editor you can use to make any modification you want to fight and write complete files. And that's what we're going to see now, you're going to use the Nano text editor. You're going to see how to configure it and then how to use it to write and execute basic bash programs, which we are going to see just in the next few lessons. And so we are back to our home directory. We have this. I'm going to go to my documents folder where I have my GPL here, file and hello.txt. So in the hello.txt we have three lines here. Now to modify the file with the Nano text editor. Well, that's simple Nano. You can directly use the nano command. And this is going to open the Nano text editor. So nano and you can provide a name of the file that you want to modify, for example. So nano hello.txt, I press Enter and you see we have a completely different view. This is the text editor. So it might seem complicated, but actually this is really not. So you have a cursor that you can move with the arrows of your keyboard. Ok, so that's, you can just move anywhere you want. And then if you press any key of the keyboard and the letters we can press Enter, it's going to go back to a new line. You can press any later. So let's say hello world. I'm going to add a new hello-world. And you can just add any text you want. Okay? So I'm going to add a few more lines. So let's say a few more lines and dangerous one for just any number of lines in random texts, I can add a right. And now I have modified the fire. If you want to exit from the file. Well, there is nothing to click on. Okay, but you can see here at the bottom you have some help you can use. So this is control our comment. So control experimental, I'm going to press Control X. And you can see the one to save the modified buffer. In other simpler words, do you want to save what you modify it? So you can put Y or N, yes or no. I'm going to put y. And then finding the right hello.txt, I press Enter, and now I'm back to the terminal. And if I do cut hello.txt, I have, you can see the new text I have written before. So I can go back to it. We've nano hello.txt. And I can just remove some lines or modify your files again, do whatever I want. What I can also do now is to save the file. I can just do Control S. To save your file. You can see here wrote 20 lines and then control X to exit directly or Control S, Control X. And now so we're going to clear. And now if you want to create a new file and add some text to it, you can first do touch, create a file and then use nano to go inside the file. But you can also do directly nano. Let's say I'm going to name it new file. I press Enter and then I can write. So I can write here and here. And here, Control S, Control X, ls, I see new file, cat, new file. Boom, I have my file here. That's very fast. So as you can see, using nano in the terminal can really be much faster than having to use a graphical interface, okay, graphical interface. You will have to start the graphical interface, find the file, write the file and then save the file India and then gone back to the terminal, etc. Here, that's very, very quick and simple. And now as an exercise, I'm going to do something fun to do. So political less GPL. You can see that the beginning is, well, you can do whatever you want with this, but changing it is not allowed. So let's say you want to have fun with that and publish a license that is completely not valid. You can modify just this line to say that, well, you can actually change the license. So try to do that with nano and then watch the solution. So pause the video. And now here's the solution. So nano GPL, x3 dot TXT. And now I can move. So you can see you can move with the URL of my keyboard. And I can just go back here. And let's say that I'm going to put and changing it is allowed, okay, I can do Control S, Control X. And now I have just modified the GPL texts, which is definitely not valid anymore, less GPL, you can see I have the modified text here. This or if you just want to modify one part of a file like this, using nano is very efficient. 16. Configure Nano (.nanorc): Now you can use Nano with the default configuration as it is installed. But what you can also do is you can add some configuration. You can add any configuration you want. Okay, just like you could do in any text editor with a graphical interface. And actually, let's do that with an example to see a real use case that you are probably going to need in the future. So I'm going to go in my hello.txt, nano that TXT. I'm going to just clean a few things here. And now let's say I want to put a tab here. So this text, I want to put a tab. Now as you'll see when I add a time, It's like basically it's like there are eight spaces. And if I go right or left, directly goes from the beginning to the end of the tunnel. This when you program is not good. Why is that? Because in programming the convention is to replace tab with spaces. So instead of using a tab, for example, what you want to do is use spaces. Let's say a few. And now you can see I have spaces. Okay? This is how you should do in programming. And maybe you want the top to be only two spaces are four spaces. So that will not be convenient to just use base every time you want to use the tab, okay, the Tab key from your keyboard. But that's not possible with this configuration. So you will need to modify the configuration. So I'm going to save control S, I'm going to exit control X. And I'm going to clear and go back to the home directory. And to add some configuration to menu, you're going to need to create a new file, which name is dot nano assay. So for example, nano nano acid, as you can see, this is going to be a hidden file and this is named nano asic or running commands. So basically, you're going to run some commands whenever you start nano to add some configuration. And you need to provide this exact name. Otherwise it's not going to work. Okay? So here you could first create the file and then modified or just use nano to create and modify the nano configuration file. Okay, So actually you use nano to configure nano, press Enter. So this is going to add a new file in here. You can add, for example, set tabs, two spaces, and it should turn green and bold on a new line, set, size four. So basically what you are telling here is to use spaces instead of tabs. And when you use tab, you actually use four spaces. So those are just two options, two instructions you can give to nano and I'm not going to list all of them. Okay, that's just an introduction so you can see how to configure Nano. Then if you want to get more configuration, more options, you just find them on Internet that very easy. You type nano asking and you have a complete list of options. So Control S, Control X. If I do ls, I don't see the file. If I do ls dash a, I see dot nano, SEE I can do cut dot nano assay to see what's inside the file. Okay, Now let's go back to our hello.txt. So nano document, hello.txt. I am going to go here. I'm going to remove the produce down and I'm going to add a new tab. And now as you can see, when I go left, I actually have four spaces. I don't have a tab anymore. So great. Now you can use nano to edit any file you want. And you have also seen how to add some configuration to it. 17. Create and Execute a Bash File: For now, all you've done with files is to read them and write to them. There is something else you can also do. You can execute a file. And here we have an example. I'm going to show you how you can create a batch file which will contain some bash commands and how to execute that. What is a bash command? Well, the bash command is simply any command that you have previously typed in your terminal. So if I do history, for example, story, you can see all those commands you have written before, all those comments, stuff that you can actually write inside a bash file. And so we're going to go ahead and create that batch file. I'm going to clear, let's say. So I'm in my home directory. I want to create a folder just for the batch file. So MKDIR, let's say my bash script. So we can also say that those are scripts because we're going to execute the script. Okay, I go to my bash script. And so LSI have nothing here. And I'm going to create a new file, nano. Let's say my script dot bash. So here the dot bash is actually important because this is how basically linux is going to recognize that this is a bash scripts that you can execute. So nano, my script dot bash, I press Enter, and now I'm going to write some bash commands. So for example, I can do wonder is very illustratively to do equal hello from a bash script. And you can see I also have some color, okay, For the syntax, which makes it much better to read and to write. What I can also do. This is a new command. You can use sleep with a number, let's say sleep and three. This is going to basically sleep for three seconds. So stop the execution for three seconds and then come back. So this you can execute directly in the terminal. Okay, I can open a new window here and do sleep 3, 1, 2, and 3. And we are back to the terminal. Okay? So these are going to write this in my bash file. Then it's a equal n. So now I can do Control S, Control X, and I can cut my scripts that Bash NIC, three lines I have added in my file. And no, well you can do things much more complicated in Bash scripts, but I'm going to keep it simple here, okay, the syntax, the functions, all the programming logic, etc, is outside of this course. Okay, here you are going to learn how to use the command line. And well, if you want after the coasts, learning how to create Bash scripts with all the programming side can be a nice following ID. So now that you have these, how can you execute it? Well, you can just execute a file like this. You first need to make it executable. And to do that, I'm going to use CH mode plus X. So X four executable and then my script that batch. Okay, So this actually I'm going to come back to that common in details in the next section. But for now, just run that command. And then you do ls again. You can see now the file is in bold and green. So that's specific to Ubunto, of course, maybe in different operating systems you will have different colors or nothing at all. But now the file is an executable. And if you want to execute it, you can just do dot slash, name of the fire. I press Enter. You can see Helen from a bash script and then we have a sleep of three seconds and then end. So just as if we had typed those commands in the terminal directly. Okay, So that can be very useful and that is actually your first step with automation. And one thing that you can do is when you run a bash script that doesn't written directly and that takes some time to execute like this one, which will take three seconds. So I'm going to run it and you can press control C. You can see I press Control C. And this is going to directly stopped the scripts and go back to the terminal. All right, and knowing that batch script where you're going also create folders. You can create files with touch. You can, well, you can do anything you want, okay? You can create a complete script to create some directories, remove some other directories, okay, create some files, etc. And you can have as many lines as you want inside the script. So basically you can automate huge portions of your work. And at the end, once you have written the Bash scripts, you just need to run it like this. So you make it executable once. And then you can run it as many times as you want with just one command. And if you are in a different directory, let's say I'm in my home directory. What I can do is simply do my bash script, my script dot bash, and this is also going to run the script, okay? So you just put any folder with a relative path on absolute path and then the name of the script. And if you are directly in the same folder as the script, you just need to provide dot slash before the name so you can run it. All right, so to recap in this section, you have seen how to edit a file with nano, okay, directly on the terminal, how to configure nano. And you have seen how to create bash files with nano and then how to execute them to automate your work. 18. What You Can and Can’t do as “your user”: You have now seen the most basic and important things you can do in the terminal. You can navigate between different folders. You can create and modify folders and files. With nano, you get the complete text editor without leaving the terminal and you can start to do some automation with bash scripts. In this new section, we're going to look at permissions and what you are allowed to do with the user. You have created the user edit here, you will see how to run a command with Admin privilege. How to see what are the permissions for a file and how to change those permissions. Let's get started. So we are back here to our home directory is slash home slash in this directory, well, if you are the user, add in the slash home slash Ed directory, well, you are kind of the King of that directory. You do whatever you want. Can you have seen before we can create readme file, edit files, execute files, whatever we want. Now let's go to Sydney. So cd slash, we're going to another folder which is not in our home directory, which is starting from the root file system. So let's go to ETC, where you have some configuration files. And let's go to APT. Okay, so ls, you can see here. So I'm going to come back to APT later in this course. But this is where you can have, for example, a file with sauces docList, which contains the list of different sources so you can update your packages. But for now, let's forget about this and let's just focus on what we can and what we can't do with the files and folders here. So let's say I want to print what inside this, I can do cut. So sys dot lists. Okay, great. I can see what's inside the fine. So we have a bunch of lines here, blablabla, we don't need to worry about this. I can also do less sources the pleased to just go through the final No problem. Let's clear. Now let's say I want to move the file, MOOC, sauces dot list. I want to move on, just rename it to ABC. I press Enter and you can see cannot move because permission denied 0. So that's different from what we could do in our home directory, okay? In our home directory, this would not have been a problem in the slash, ETC, slash APT. We can't do that. Let's try a few more things. Let's say want to copy and I want to create a new file. So first if I do touch taste, well, I can't create a fire. I do CP sources docList in, let's say test. Well, I can't because I can create file so I can copy a file to a new one. If I do, let's say echo. Hello. And I want to add some texts to sources dot list. Well permission denied once more. And finally, if I do nano, well, I can open in Nano because well, I could read the file, but you can see file is unreachable. So let's say modify the file and add some random text here. And now if I do Control S for saving, you can see permission denied. So what I can do now is Control X and well, I have to say no. Do you want to modify know? Because I caught. So from the experimentation here you can see that it seems that when we are in a folder which is from the root and which is not in the slash home slash. Our user. Well, we can read some files that we can't create files. We can't modify the files. Okay? So this is the experimentation and later we're going to see exactly why and how to fix that. If you really want to modify a file, for example, sauces docList. 19. Run a Command with Admin Privilege (sudo): Here I'm going to show you how you can run a command on the terminal with Admin privilege. So basically any command that didn't work before where we had a permission denied. That's going to work with Admin privilege. And if you have used Windows before, which I guess yes. You know that there is an administrator user and sometimes your user or session doesn't have the right to do something. In this case, you just use the administrator privilege. And that's kind of similar with Linux. You have your user head with which you can do stuff and with which you can't do stuff. And well, if you can't do something, you can actually do it with Admin privilege. And if you want to run a command with admin privileges, you simply do sudo and then the command. Okay, so you just use sudo before. So now let's say I wanted to touch base, which of course doesn't walk here. I can do Sudoku touch tests. I press Enter. So sudo is going to ask for the password for the user, add first, so you type your password here. So it's not going to show it. Now I'm going to show the number of letters. You just type the password and press Enter. And now you can see I don't have any error. I will address and I have the test file here. So that worked because I used the admin privilege with sudo. And now we're, let's say I want to edit this PI with nano, nano test. As you can see, I still have five tests is unreliable. If I do Control S, I still get a permission denied. Okay? This is because I'm going to Control X and N for no, This is because, well, I'm still not in my home directory, so I used the admin privilege to create the file. I also need to use the admin privilege to edit the file ABC. I saved the file, I exit the fire not cut list. You can see I have correctly written into the file. And the same if I want to remove the file test, I do sudo our m and the file is gone. So here getting the admin privilege is nice, but you have to be very careful with that, okay? It's not because you can do something that you should do it, okay, For example, don't modify the sauces dot list file or don't remove any of those files are kept because you could theoretically do it. But then if you do that, maybe you're going to have big problems when you try to update actually dissociates from that list. Okay, so we have leanings in the terminal. You have a lot of freedom. And here the following saying is 100% true in that situation. With great freedom comes great responsibility. So basically, whenever you want to use sudo, make sure that you know exactly what you are doing. 20. Understand File Owner and Permissions (ls -l): And now I'm going to show you the explanation of why you could do some stuff. For example, read the file and why you couldn't do some stuff. For example, you couldn't write in the file as simply as the user aid without the admin privileges. So I'm going to clear, and so I'm going to do LS, but I'm going to add dash l for list. And this is going to give us a list. So this is the exact same list, but with much more information. And hence so well, you have that first, I'm going to come back to it later and then you can see I have routes and routes. Okay, Let's do actually ls dash l from my home directory. So if I do ls and I provide a directory that's going to do ls in that directory. Okay. I do this. So this is, as you recognize, the home directory with the Document Downloads, et cetera, you can see a major difference here. You can see roots, root here and add ED here. This, here, this information is actually the user, so the owner of the file. So you can see in my home directory I as the user L and the owner of all the documents. So all the directories and files. Okay. But if I am in that slash, ETC, APT folder, the owner of the file is not add. The owner of the file is the root user. So you have a root user, which is basically the most powerful user, okay, in the file system. So you have the root user and you have the add user. And so as you can see, the third thing here is that when I use the terminal here as the edges are, I don't own any of those files. And then the second column here is the groups. So you can have groups. If I do recommend groups, I can see the groups. I am currently in obese. So you have users and you have groups. So for each user you have a group which is the same name as the user. Okay, this is what you see here. The root is inside the root group, ed is inside the head group, and then you have different groups. You can see pseudo. That's why I can use sudo actually, because my AD user is inside the sudo group. And then different groups that you don't need to worry about that for now. So first you can see this is the user which is the owner of the file. And this is the group also for the file. And if I go to the stuff on the left, okay. You can see it first starts with a D K when it's a territory, and with a dash when it's a simple file like this, with a dash. So this just Directory or dash. We don't really need to worry about that. And then you have nine characters. And the nine characters are basically three times wx and w x and w x. R is for reading, w is for writing, x is for executing. The first three characters are actually related to the owner. So due to the user who is the owner of the file, then you have the same for the group. And then you have the same for any other user, which is not the owner and which is not in the load group. So let's take an example with that sauces dot lists. You can see the ulnar is ropes, so the user routes. So the user routes. What can the user routes do? The user can read and can write the file. But this file is not an executable, so it can't execute the file. Now if I am not the user routes, but if I am in this group, I can read, I can write the file and I can't execute the file. And if I am a user, which is not in that group, and which is not this user. What I can do is I can simply run the file, but as you can see, I have a dash here so I can't write. So basically when I tried to write into the sauces, that list as the Add User, I just didn't have the write permission here. Okay. If I look at this file here, test file.txt, I can read to it. Why is that? Because the first three characters here, I have our W for the user. So that is the explanation of why you couldn't write. But you could read as the end user inside that directory. And then, well, for folders or directories, you have the x, which basically the x doesn't mean executable here, just means that you can search inside that directory. And if I go to my home directory, if I go to my Bash scripts and if I do ls dash l, you can see we have an executable here. And so our user can read, write and execute. The users in that group can read, write and execute. But any other user which is not in that group can only read, can execute, but not right. Okay. So basically that's it about the permissions. You have different users, different groups, and then you have permissions, reading, writing, and executing for the user, for the other users who are in the groups here. And for any other user that is not in the group. 21. Change a File’s Owner (chown): And now that we have seen the permissions, so basically the owner of the file and the different permissions for read, write, and execute for each kind of user. Well, I'm going to show you how you can actually change the owner of the file. Okay, so let's go back to the ETC, APT. Okay. I'm not going to touch the sources that list because that's dangerous. Okay, I'm just going to create a new file. So pseudo, pseudo anyway, Dutch tests. Right? Now if I do ls dash l, what I can also do is ls dash l directly with the name of the file. And I just have the permission for that. So as you can see, when I create a new file with sudo, the owner is the root user. It's not at the root user. And you can see I can rewrite the file as the root user with Sudo, but as the user, I can only read the fight. So if I tried to do nano tests, you can see I can't write inside the file. I'm going to exit. And what I can do is I can use the command CH town to basically change owner. Hey, so if you need documentation, you can do man CH, own and you can see change file, corner and group. We can also change your purpose you want. And so what you have to do is to put CH town and then the new owner and the fire. Okay. So I'm going to press Q. Let's do clear here. I'm going to do CH n, which is my user tests for the test file. And of course, this is not going to work because I can't change the ownership as Ed, I need to change the ownership with admin privileges. And now if I do ls dash l, you can see testfile. So it's still with the root group, but the owner of the file is no ADH. So this first rule now applies to the end user. And you can see everything is root, just this one is eight. So now if I do nano test as the edges are, you can see I don't have any problem. I can write some text here and I can save it and I can exit. And if a you cut test, you can see I was able to write some texts to the file without using admin privileges because now I am the owner of this file, okay? And I'm the owner of this file, but only this biochem still not the owner of the directory or any other fine, Just that one. And if I want to remove well, that's not going to work because as I'm not the owner of that directory here, I can't remove the file. So you can see as the end user in that directory, I can read, write the final, but you need to do sudo and tests. And that's going to remove this. 22. Change a File’s Permissions (chmod): Now that you have seen how to change the owner of a file, we're going to see how to change the different permissions, okay, at the file level for each, so for the user, for the group, and for other people, okay, we're going to see how to customize that as you want. And I'm going to come back to my home directory actually for that. And let's use the solids, use the my Bash script that they have created before. Ls dash l. You can see two ion here, the owner of that file. And we have this. So first dash because this is not a directory. And then I can read, write, and execute. Any other user which is not add but inside the head group can read, write, and execute. And any other user which is not in the group can read execute, but can't write to the file. And so if you want to modify those permissions, you can use CH mode. So basically you have CH and change the ulnar CH mode to change the mode of the permissions here for the fire. And you can have different combinations. So if you want to modify only something from the user, you can do You, okay? And then you can do plus or minus two, add up to remove a permission. Let's say I want to remove my own permission from a user to write into the fight. I'm going to do u dash 4 minus w. And then the name, of course, of the file. Now if I do ls dash l, you can see that I just lost the right privilege. So knife I do nano my scripted bash. You can see permission denied. Even if I am the owner, I just removed my right privilege here. I want to add it back. I can do CH mode you, So for the user plus w, my scripted bash, and this is back again. Okay, Now you can do CH mode, for example, g for the group. Let's say you want to remove all the permissions for the group. I'm going to do g minus r w x. Okay? So you can remove all of them at the same time issue with the name of the file, of course. And then if you do ls, l, you can see all the permissions here are gone. So anyone in the group, which is not the end user, not going to be able to even read the file. Okay, let's ignore, for example, I want to remove that. So what I can do is CH mode o for other minus my scripted bash. And no, as you can see, only mean can read and write the file. The group can't do anything. And other people can just execute the file without knowing what's inside and without being able to modify it. Now, for example, when we use the CH mode plus x k, when you just don't put anything before, it's going to put that for all the users. So if I do minus x, as you can see, now, all the x, so these three are gone. If I do CH mode plus x, it's going to add the execute right to all users, okay, Now, if I do CH mode plus w, For example, The thing is that you can see that it's only going to apply for user and for group, okay? When you don't precise any kind of user before we've x is going to add executable, right, for everyone. But we've wn, which are also, It's only for the user and the group. So you have to manually say, for example, CH mod U, G and O, user group, other Plus rights, add to everyone. Okay, So basically you have seen all the combinations you can use to modify the permission for that fire. And now as an exercise, what you're going to do is to modify the permissions to meet the following requirements. So now what I want to do is I want to say that me as a user, I want to be able to read, to write, and to execute the fire. I want also the people from the group to be able to read and to execute the file only, not to write. And any other people can only execute the file, okay, without reading it and without writing it. Okay? So now you can pause the video, try to do that, and then watch the solution. All right, and now let's see the solution. So let's start with what we have. Okay, So if the file is not executable, you can do CH4 plus x to make it executable for anyone. That was already done. Now, as for my user, I want to be able to read, write, and execute. So if you don't have those rights, you can do U plus W and maybe x with x was already done before. So that's not going to change anything for the group. The group actually count rate but can write to the file. So that's quite weird, but that's the permission that is set right now. So I'm going to CH mod g minus W. To remove the read permission of my script, I'm going to do CH mod G plus R to add the reading Domitian on my script, ls dash l. You can see that it's better. We have our dash X and not for other people. So the contrary the files that good. But I'm going to remove the W. So CH mode o minus w, my script dot dash ls, dash l, n. We have the correct permissions. So I, as the user l can read, write, execute. Anyone from the group can just read and execute. And anyone outside of the group can just execute. All right, so to recap, you have seen here in this section that you can have different users, okay, you have the root user and then for example, your own user, which is the add user. So in your home directory, you are free to do whatever you want. When you start to go in the system flies, okay, or the configuration file, the boot files, etc. You are going to lose some permissions and you can use sudo to get Admin privilege. But use sudo carefully because you can mess up your computer in just a few seconds. Then you have seen that every file or directory has an unknown. So user, which is the owner, a group, and then some permissions to read, write, and execute. And you have seen how to change the file owner with CHO and how to change the mode for the permissions with CAH mode. 23. Install and Remove a Linux Package (apt, yum, brew): After seeing file permissions, etc. In this new section, let's do something a bit different and super-useful. Let's see how to install new software packages on your Linux operating system. And of course, using only the common line. So by default, you already have a lot of tools and functionality is installed, but you can get much more by installing new packages. We're going to see how to install one package here. And then in the following of this course, we will install some other packages when we will need specific functionalities that are not valuable. One thing to note here is that the installation command can be different between different versions of Linux. So all the commands we've seen previously should work fine on any OS. But here for your poll, you will have the APT command for Debian Ubuntu. As I'm using here. You will have the yum command on OSs like cent OS and Fedora. And you will have the brew command on Mac OS. Okay, so let's start with APT, and I'm going to show you the variations just after that. So I'm going to install one package here. And this package is so good, is basically a versioning system for when you write code. It makes it easy to collaborate in a team with many people working on the same project. And it's very probable that if you work in software development, you are going to use gets every day. Hey, so I'm not going to explain more about Git and how it works. Okay. Just That's the example for installing a package. And so document of gate is just gets. So if I press Enter here, you can see we have common good not found, okay, because Git is not installed. So to install, I'm going to clear, I'm going to do a two-step process. First, sudo APT update. So the APT command before the package management and then you update and you have to use sudo, so you have to use the admin privilege. So I put the password, you have to use the admin privilege in order to update the sauces. So what this is going to do is going to download the latest sources. So it's not going to upgrade any package or to install anything. It's just going to allow you to get the latest version when you want to install a package now, okay, So once I have done sudo APT update, I'm going to do sudo APT install and I'm going to provide the name of the package. So good. If you want to install multiple package, you just put all the names of all the package separated by a space. So sudo APT install Git, I press Enter. And you can see here what we have. It's going to tell you what is going to be installed. Okay, songs suggested packages maybe. And so it's going to install three packages, good, Gutman and leave Iraq pill, okay, because those are surely dependencies of kids. And so it's going to tell you how much it's going to download and then how much is going to add to your space. So you can see 38 megabyte. You have to just select Y, okay, and press Enter to continue. Well, and that's it. Get is now installed. So if I run git, now, I have, so you can see I still have some text here for the usage. So basically that's the help of good. But you can see now that good is installed. So that's super easy just to commands and you have installed any software. And now if you want to remove that software, you do sudo APT removed and then get. So you press on y and you press Enter again. And now git has been removed. So now I'm going to show you very quickly the different comments for different operating systems, okay? If you have something different than you into. So I'm just going to create a text document here to show you the different command side-by-side. So let's do nano and install command. So on, you're going to have sudo APT updates to update the sauces. And then on CentOS you're going to have sudo yum. Check updates to put a pipe here instead of just like that. So instead of update you to check a big N on Mac OS, you brew, update. You don't have to but slow. And then to install, sudo APT install and then the name of the package. On CentOS, you're going to do sudo yum install with the name of the package. Okay, so that's the same comment and brew install with the name of the package. So for that command that just installed for all three, okay? And then for remove, you are going to put sudo APT remove. We've name of the package. We've young, you are going to use also pseudo remove package and also broke remove package. Okay, so that's the same for installed energy moves. Just a little difference here with yum, check the date. 24. Update Existing Packages (update, upgrade): So you have many installed packages on Linux, and as you could see before, you can install many more. Now, how to keep your packages, update it, because you will see that for many software, you get new releases quite often. And the best practice is to keep your packages up to date, especially if some of the upgrades are security upgrades. So I'm going to clear the terminal and I'm going to show you how to upgrade any package that you have. So the first step is to do sudo APT a bit. Fiona, first update the sauces. Okay, That's very important. And then you can see you have an inflammation here, for example, 125 packages can be upgraded. So now that you have updated the sources, you're going to do sudo APT of grade, and that's going to upgrade every package that you have with the sources that you've got previously. So you press Enter and you can see that we have. So it can depend on basically the last time you updated, okay, Here I have many packages to ablate. I can see you may have more, you may have less. It depends. And so I just select Yes. And I press Enter and then I can wait until the packages are upgraded. Okay, and when you get that, all the packages you have are correctly upgraded. So if you do sudo APT upgrade, again, you will see that you have 0 package to a grade 0 package to install. And you may see something like that. The following packages were automatically installed and are no longer required. And so what you can do is to remove those packages which you don't need with sudo APT auto remove. So this, after you do an upgrade is going to clean some packages that you don't need any way and you can see that can be quite big. So yes, once again, and this should be faster than the upgrade. Okay, Great. And now one thing you may want to do after, so after you install the package or after you upgrade some packages, okay. To make sure everything works correctly. Especially if you have installed or abraded a lot of packages is just to reboot your operating system. So to reboot, you have two options. First, you can just shut it down and then start it again. We, for example, pseudo shutdown. Now, this is going to shut down the machine directly. So of course, make sure you use sudo and provide your password if needed. And if you just want to reboot, okay, instead of just shut it down and starting again, you can use sudo route. So I press enter and this is going to robots the Linux operating system. Okay, Great, So that's the best-practice actually if something doesn't walk, okay, first thing to try and just reboot, okay, before anything else. Can 50% of the cases that's going to solve the issue. Alright, and now I'm going to show you the different comments for the different operating systems if you want to upgrade your software. So I'm going to do nano install comments. I'm going to go in that file and I'm going to add something to add sudo APT upgrade, which for you is going to be sudo yum update. Okay, that's different. The update of the Yom is actually a great, okay, and check update is for a day. So that's a bit different here. Okay, For grow you have broke a great Also just like APT. And then for auto room you have sudo APT auto remove. And then you have sudo yum, auto remove. Then if you are using Fedora, okay, that's only going to work after Federer. 18 are a more recent version. And brew. Auto remove, same for Group, okay, the auto remove is quite new to grow, so make sure you have a recent version okay, to use auto removed with yum and we've broke. Okay, so here you have all the commands that you can also find in the additional PDF that you can download with this course. And so to recap on that, well, once you have installed the package, don't forget to check from time to time if there are new upgrades. Okay, we've sudo APT update and then upgraded with sudo APT upgrade. 25. Extra: Use Snap on Ubuntu: There is one more way to install software that I want to show you because it's super practical. But note that this is specific to Ubunto and actually developed by the company behind the development of human too, which is named cannonical. So if you are not using Ubuntu, you can just skip this lesson. And so we're going to use snaps. So you're going to snaps to install software. So for example, let's say I want to use the tree program, okay, the true program is going to create a tree of the directory. And you can see so the program is not found, so not installed. And we have a suggestion here to install it with APK, just like we knew before, to install it with nap. And so that's a different package manager for a human to get that you can use because well, it's really working well and you will not have any dependency issue when you use now, okay, that's a good package for you. And so if you want to install tree, you can either choose APT snap. And if you want to install we snap, you do sudo snap install trick. You press Enter, you put your password if needed. And it's going to download and install the software. Okay? And now the software is installed, you can just use it for your tree. And you can see we have the trade off our home directory. Now if you want to see the list of all installed snaps, you can do snap list. You don't need to put pseudo here just to see the list of all snaps. And you're going to see, for example, here we have tree, here you can see the version, revision, etc, the publisher. So you can have a quick overview of all the packages you have installed with snap. Now if you want to upgrade, okay, this, what you can do is do sudo snap, refresh. So just one comment, okay, that's going to do the, basically the APT update and APT agree. So if you do that is going to refresh and upgrade all snaps. And you can see all snaps are up to date now. And then if you want to remove a package with nap, you do sudo nmap, remove tree for example. And that's going to remove it, and that's it. So you have a complete list of comments with Snap dash, dash help. Okay. So with any vehicle, any package, any software you can do dash, dash help and you're going to get first help, okay, with a description and some commands you can use. So that's how you use snap. And now we have another example. I'm going to install another package, which is, so for example, this package, Visual Studio Code. This is a complete IDE, so integrated development environment for you to write code, okay, I'm not going to show you how to use it, but just how to install it. So these two install it on a human to is not as simple as just doing sudo APT install code or VS code. Okay? You have to run a few more comments. But if you use naps, because now you can see there is a snap. You can just use sudo snap install code. And then you have dash, dash classic. So for example, pseudo snap install code with their dash classic. And that's going to install Visual Studio code with just one line, which was not possible without the snaps because all packages also to as are not actually the APT. And so now it's working and you can just run code and you can start Visual Studio code with just one command. You have installed Visual Studio Code on new window. All right, and that's the end of the section on how to install an upgrade software on your Linux operating system. 26. Find a Specific File by Name (find): You have now most of the basics to be confident with the Linux command line. In the following lessons, I'm going to show you more commands and tools that are going to make you more productive when using the terminal. Because knowing how to do stuff is nice. But knowing how to do stuff faster is even better. And we're going to start with basically how to search for certain files in your file system. So you've already seen the command ls. Ls, we'll just list the files in any directory you want. Now you also have the find command and you have to provide, so fine, you have to provide a path. So if I just put dot, it means the path here. So that's going to be the home directory. Let's press Enter and you can see we have a lot, a lot of files, so find is going to just print the list of all the files it has found, okay? Including the hidden files, okay. Everything and everything inside every folder, etc, etc. So you have all the different facts, that's a lot. And then for example, if you want to find and list all the commands in slash users slash bin. Okay, you can see that we have many comment here. So find lows you to just list everything recursively inside a folder. Now, if you want to sort by name, you can use the name option we find. So let's have an example for that to clear. And I'm going to find dots are I can do also till the for the home folder. And then we have the option dash name. And then I'm going to put inside quotes here, my and then a star. Okay? Basically this is going to tell the find command to search everything that starts with my and then has any other character after that. So I press Enter and you can see that in my home directory I have. So I have my folder and then inside my folder, I have my other folder, and then I have my file inside this. And I have my Bash scripts folder or directory, and then my trip. So everything that contains my at the beginning is listed here. The very important to use the star, okay. If you want to be able to get all, if I just do my you can see we don't have any file or folder named Maia. Okay. If you do my star, It's like anything that starts by my own case, you want to have my in the middle, you can do this. And if you want to have my At the end, you can do this. So let's have another example. If I want to find all the commands in slash users slash bin. So dashed name that contain the. So basically I'm going to put stars before and after. So I can just get all the commands. You can see MK, DIR, he, I see DIR here, here, okay, so you can see everything that contains DIR is listed here. So that's a powerful way to search for different files. Now, one more option I'm going to show you so to clear. So let's say you do find dots. Okay. I'm not going to read it like that. I'm going to put another option, max depth one, okay, and let's see what it does. So you can see max depth is, well basically the max depth for the find command to search for files and folders. And here is just one. So it's just going to find everything that is at the depth of just one which is in the home folder and it's not going to search inside the directories. Okay, So you have, for example, the my bash script, but then it's not going to search inside it because of max depth one. And then if you do make steps too, for example, you can see you have more files. Okay? So basically it's going to search for directories and then inside those directories for other directories and files. And that's it. It's not going to go further. Okay. So you can play with that, you can play with that, end the name at the same time, okay, use the two options. So let's say you want to max depth of two and select name with my status by my okay. And you're gonna get that. Try to max depth one. You can see that I just have those folders and I don't have folders or files inside them. 27. Find Lines Containing a Pattern (grep): So now you have seen how to find a specific file by name. Let's see how to find lines containing a pattern. So that's a little bit different. Here we're going to take an input, for example, a file on any input of texts. And from that we are going to just find the lines that we want that match a pattern. And for that I'm going to go in documents. And here we have the GPL file that I'm going to use. So let's say I want from that file to list all the lines that contain the world freedom. So I'm going to use the grep command here. Okay, That's a new command, grep command, rape, freedom. Like this, the name of the file. And you can see immediately, I have all those lines, okay, We freedom in bold and right here. So 12345678, lines containing freedom. Now let's say I want to find all lines containing the just be like that. Well, we have quite a few, as you can see. And you can see that this is case sensitive, okay? So if you put D with uppercase T is going to make sure that this is an uppercase T. Now if you do for your bowl dash, before, this is going to ignore the case, okay, So any lowercase or uppercase is going to be valid. Okay? You can see now we have much more reasons, okay, with V and the two different ones. And now so it's two clear. Let's say now I'm going to come back to that command. You want to list the lines that start with D, okay, just the line that start with D, not any line that contains the, in that case, you can add this. So basically this is a regular expression, okay? I'm not going to go phi into that because that's outside of the scope of this course. But if you want to learn more useful stuff after this course, you can go check out the regular expressions. So if you put this and then some texts, some letters, it's going to search for any line here. We'll grab that starts with that. So I press Enter and you can see we have just one line that starts with D, which starts actually with 0 space and D. Now if I do this again and I put two spaces, you can see we have more lines that starts with just two spaces and b. Okay, so that's very powerful. With the grep command, you can find any line that contains any kind of expression, okay, inside a file, for example, here we have two spaces and the uppercase. 28. Pipe with Examples: Pipes are super useful in the terminal. They will allow you to combine and chain multiple comments together and just go much faster. And let's see that directly with an example. So pipe is actually this character. Alright, so now let's say I'm in my home directory and they do ls dash l to list all the files that I have. And you can see I have a list. And now let's say I just want to get the number of lines that I got here from the ls dash l command. So I'm going to do ls dash l pipe WC, which is word counts, which is going to count the lines and the words. And boom, you can see we have 14 lines. So what happened here? Because the ls dash l command did not print any output on the terminal. Okay, so by default, when you run a comment, okay, the output is going to go here after on the terminal. But then if you use a pipe, the pipe is a very special character that is going to redirect the output of the command on the left to the inputs of the command on the right. What's going to happen here is that first discussion is going to get executed. And the outputs, instead of going to the terminal, is going through the pipe to the command on the right, which is WC. So after this communist executed, that command will be executed. But with what inputs? With the input from the ls dash l command. Here you can see with WC, we didn't provide any text phi are any input here because we have a pipe that's going to use the result of ls dash l. So this command is run and then pipe. The result is passed to that command, and then you get 14 lines. And so let's take another example. Let's say I do Find slash users slash bin. Let's say I want to get all the files in that directory that contain DIR. So we've already seen how to do that we find, but what you can do also is just to find all the files in that and then pipe, pass that to the grep command. And the grep command you just put DIR. And you can see we have the same result as before, okay? All the commands here, all the files that contain DIR, but here we also have the DIR in red and bold. Okay, so that's even better in the terminal. And so this basically listed all the files. The output is passed to the grep command. Then the grep command is going to search for all lines, okay, of the output here containing the, okay, so we've grabbed, as you can see, you don't necessarily need to use grep on a file. You can use grep on the result you got before using a pipe, okay, and same for WC. And now let's say you want to know how many comments in that directory contains the, then you can just do this. And instead of just printing the output here, you just add another pipe and WC and you have 17. As you can see, 17 commands are files that contain DIR. So you can see two pipes here. So you can chain as many pipes as you want. Now let's go to the document folder. Okay, I'm going to clear and we are going to walk also again with the GPL file. So let's say you want to know how many lines contain the word freedom. Well, so you can do grape. We've freedom. So you can use quotes or not here, because we just have one world. And then GPL. And then you can do pipe WC, and you can see 8, we have eight lines. Note that what you can also do to get this result is first to use gut WorldCat GPL. But of course you're not going to print it on the terminal, then grep, freedom. So let's put quotes again. And then WC. And you can see we have the same result. So cats is going to print the result of the file, which is going to be passed to the grep command, etc. So that's an example to show you how you can use Paypal. So here and now let's say that you want to write the result of whatever you found into a file. Well, you can just use the angle brackets like we did before with the echo command. But here you just going to get the output of one command. And let's say freedom, that 60. So maybe remove that, just bring the lines with freedom. So you do cat pipe grep freedom, which is going to just get all the lines containing freedom. And then with that you are going to redirect the output of that to the freedom dot TXT file. If I press Enter, you can see we don't have any outputs. But now I have freedom that TXT, if I do cat, freedom that TXT, you can see I have just the lines containing freedom from the GPL file. Okay, so that's how you use pipes. And now I'm going to give you an exercise. So what you're going to clear that you're going to go in slash, ETC, APT, okay, and you have here, so sys dot list. So if you don't have this with APT, well, you can just go to any other associates file that you find. Here. You can search for list with the find command or just any file you want. That's not really a problem. Okay, So if you have that sauces docList file, what you are going to do. So let's see what we have inside. Actually. You can see that we have many lines, okay, starting with hashtag, okay, those are comments. And we also have lines starting with just Deb, okay? And that is basically, well, the sources that we have for our package manager. So what you're going to do is you're going to find all the lines that contain dead, okay? Just, just the lines that start actually with them, not with a hashtag. And create a new file, okay, new home directory with the list of all sources that you find from that file. Okay? So you can price post now and do the exercise. All right, and now I'm going to give you the solution. So I'm going to go back, I'm going to do CD and just do clay and work from the home directory. So what I can do is, for example, I can first, let's say print, gut, ETC, APT associates the case. Okay? So let's first get the file, okay, with the absolute path, as you can see. And now I'm going to do grep. I'm going to put quotes and I'm going to add this. And so that is going to just select the lines that starts with Deb and nothing more. I can press Enter if her water at this point to just check that I have the correct result. And yes, you can see all the sauces with the URLs. And then I'm going to redirect that to, let's say sauces dot TXT. Or maybe you can just put that in document, let's say till the dash Documents Slash sauces dot TXT. And so I press Enter. And now if I just do cat and document. So since the TXT, ok, I have all my lines, okay, with just one command, as you can see, and pipes and redirection here of text. I can get all the sauces from the sauces docList file of my package manager. 29. Linux Terminal Shortcuts: You can now go faster in the terminal with various search functionalities and the pipes which allow you to chain multiple commands together. Now, going faster also means optimizing what you do on your keyboard. And for that, there are some keyboard shortcuts that are going to save you a lot of time. I'm going to first make a quick recap of some of them that you have already seen in the course and then give you some more. So first one of the most important is the tab. So let's say you CD and lame duck. Just use tab. Okay. Used up all the time. So you stop once or used up twice to get a suggestions. Then of course, use the up and down the rows, okay, to browse from the last comments that you have executed. Okay, so you can easily, as you can see, for example, that command, I can easily run it again just with the up arrow and then press Enter to execute the command. And then two useful shortcuts is let's say you want to copy and paste some texts, okay, from 0 to the terminal. So let's say I want to copy this. I have to press control shift and see. Okay, don't forget the shifts. And this way that I can paste it in any other texts or for example, on Internet. And now if I want to paste something under terminal, I have to use Control Shift N, V and Alice going to paste it, don't forget the shift. Now another shortcut is Control C. Ok. You can see control system not to confuse with Control Shift and C. Control C is basically to stop any process that you are currently running. So for example, here you can see that we go to a new line. If I run. So in my bash script, I have a script that I can run. And I can do Control C to just stop the script before the end. You can see Control C here. And then there are few more comments LET to CD clear. Now a few more shortcuts you can use to navigate actually just on the line here of the commit. So let's go back with the history to that line, okay, which is quite big. Now let's say you want to go to the beginning of the line. So that's going to be quite long up here with the cursor and the arrows. What you can do is control a. Control a is going to directly place the cursor at the beginning. So let's say you have run a comment and you have a permission era where you just do Control a and then sudo for example. And that's it. Now, if you want to go back at the end of the line, you do control an E. Control a, Control E. Now, let's go, I'm going to go to the middle here. And let's say you want to remove the beginning of the line, so everything that is before that, so you can just press back as many times as needed or you can do control. And that's going to remove everything before the castle. And let's say I'm here. If you want to remove anything after the cursor you do control and K, and that's going to remove everything. But after. So those shortcuts are very useful to navigate in the line of that you are currently writing comments in. And so for example, if you are at the end and you just want to remove a line, you do control you. Okay? And let's go back here. If you are at the beginning and you want to completely remove everything you do Control K or you can just cut in the middle. And then one more shock at here is the control and our shortcut. And you can see reverse. I search. Basically you can search in the previous comments that you have written from history. So for example, let's say I use gut. That's going to find the first command on the history that starts with that. Okay, So cat, and you can see that was the first command that I run. Okay, Now let's say I do sudo. That was the last sudo command I used. Because if I put, for example sudo APT, so the last sudo APT common I used was auto removes. So that's not going to go very, very far. But if you have just run some comments previously, you just do Control R. And then you start with the command you want to write. And that's going to just search for the first command that matches this. So then you can press enter whenever you have the comment to just execute the command are also Control C to just stop that. 30. Work with Multiple Terminals: And to bring even more optimization, well, why should you only work with one terminal at a time? Actually, if you look at the screen of anyone working with Linux systems, you will usually see a lot of different terminals running at the same time. And this is super useful. You can, for example, edit a file in one terminal, run a program and another one, and then keep another one to find another one to monitor resources, et cetera, et cetera. Having multiple terminal windows directly available in front of your eyes is going to make you much more productive. So well, the first thing you can do is just open multiple terminals and for example, arrange them like this, and then a new window. So for example, you can just arrange them as you want and add many different terminals to your screen. So that's number one option. Then what you can also do inside one window is to use control shift and t, and that is going to open a new tab. So basically here on that window, I have two tabs, I have two terminals, Okay, Control Shift and t. I can have as many tabs as I want. So that also can be useful. And then you have other programs. So for example, you have the T max programs, so TMax that you can install and check how it's working. I'm not going to cover that now, but that's also one of the label option to have multiple, basically multiple terminals inside your terminal. And I'm going to show you another way to get that close, to close this. So I'm going to use the program that is called terminator. Okay, so I'm going to actually open a terminal to install, terminate or with sudo APT install tomato. You put your password. But yes. And then we'll terminator has been installed. So how to study it? Well, you can just run terminate or like this in the terminal and press enter. Or you can also go here, are in your program and search for 10 minutes. Or you can see you have terminal and terminator, and you have a new window. You can see the font and text is different, okay, from the terminal here, but that's basically just the new Bash Window. You can see we add, add, add dash, Vm. That's exactly the same thing you have here. Now what I can do is account so that two favorites with right-click. Now if I kill it, you can see I still have and when to stop these terminal. And so if I open the terminator, you can see, so I'm going to put it a bit bigger. We can have many different windows actually inside that window. So you should do right-click. For example, split horizontally. It's going to open two terminals like this, get us very useful and you can resize them as you want. Okay? Now, I can do right-click split vertically to have more, okay? And I can add as many as I want. And the shortcut for that is Control Shift and O. So if I do Control Shift and O, that's going to split horizontally. And if I do Control Shift and that's going to split vertically. So with that, you can see you have a really full control over what you want to display on your screen. In full screen like this, and just display what you want. And that may sound like complicated, but it's not. You just have 123456 terminals just running here. And you just run any command you want in any terminal. If you want to put one terminal for a moment in full-screen, okay, you can do Control Shift and x. Again, you can see you have a full screen of just the terminal. And if you do Control Shift and x, again, dominoes going to go back here and you're gonna go to the main view. And now I'm going to show you a few preferences. So you right-click and you can go to Preferences. And so you can change different options, okay, let you see what options you have here. And for example here you can choose to use the system font. Are you can also change it to increase it. So let's say I'm going to use a human to regular. But we've sized, let's say 18. Select Close. And you can see now I have text which is bigger for you. Unless you can see that the beer can right-click again. And let's say you want to save this layout okay, for the next time. Because if you start again, so if I do new window, you're just going to get this. And then you need to do the layout again. So you can do right-click preferences, layout and an ad. And then just new layout, just put a name, let's say Test. Enter and you have a new layout here, a close. And now if I open a new window, in that window, I can do Alt and L. And I have a pop-up here with the layout I want to choose. So test, launch. And you can see now I'm back to my layout. So terminator is actually a program that I use quite often because it's super convenient to organize your window with different terminals, okay, you can resize them, you can make them full-screen. You can, well, you can do many different things and you can choose to mix the colors, the font, the size, anything as you want. Okay, So to conclude on that section, you have seen a few comments for his will find an grep that are going to help you find stuff on the Tamil and make you go faster. And then we've pipes, you can chain different comments, okay, to get even more powerful comments. Then you have seen some shortcuts to go faster on the terminal. And also how to basically work with multiple terminal on the same screen. And that's the end of this section on how to work more efficiently with the terminal. 31. Find and Kill a Linux Process (ps, grep, kill): In this new section, I'm going to show you how you can monitor stuff on Linux using the command line. And we will start here with how to see and monitor the different processes that are running and how to find one and kill it. Kill a process simply means that you are going to stop the process. And now, what is actually a process? Where very basically put a process is anything that is running on your Linux operating system. When you open a terminal window, use that process. When you open Firefox, you start a process. When inside the terminal you use, for example, the Ls are the cat command. You start a process. Some processes are going to start and stop almost immediately. For example, here the ls command because it's very short and some other processes are going to be kept alive. For example, when you run Firefox or the less command. So now let's see how to list the processes that are running and also how to find and kill particular process. Note that I am going to continue here with terminator. So I can easily get multiple terminals in just one window. And that's going to make it easier for what we want to do. So here I'm going to do Control Shift and O, good to split horizontally. And I'm going to select the terminal on top and Control Shift and EEG. Good to have two windows here, so I have three terminals. Now if you want to list, so I'm going to use that one to list the processes. If you want to list processes, you can use the PS command. And as you can see here, we have just two processes. So ps is just going to list the processes that are running in that particular terminal. So we have Bash, which is basically the terminal bash and the PS command that we just ran. If you want to get all the processes that are running in your computer, just do PS AUX and you get the list of all processes. So you can see that's quite a big list. Okay, if you do PS AUX and then pipe WC, you see we have 189 line. So that's quite a lot. Alright, so now let's say I want to start Firefox. I can just start it there. I can study also from the terminal. That's the same because there is the common line to start Firefox, okay, to just put it there. So we have Firefox running on that terminal. Now, if I want to find Firefox in the processes, so I can do PS AUX under scroll and just find Firefox. Or I can do PS AUX and then bite grape, firefox. And I'm going to find all processes containing Firefox. So you can see here we have quite a few lines, but basically each line. So here you can see each line in going to start with the user who is running the process. So for example, you have user root. Here are the user aid, which is my user. And then you have a number. This number is super important. This number is the process ID of the PID. Okay, That's going to be super important for what we want to do. Then you have a bunch of information. And finally, at the end, the name of the process. So here we have basically one here too, that is still the line here. So 123456 processes listed. So you have the grep process, okay, that's we just run git, so that's when is the graph. We don't need to care about that. And then you have five other ones. But basically, usually how to find the process you want. Here. If you want Firefox, well, you just run the command Firefox. So that's going to be that one, okay, without all the parameters and arguments. So usually the shorter is the one you want to find. So now that we have found that process, we also know that this process has the PID 51, 61. And so if I want to kill Firefox, what I can do is use the command kill dash nine, and then just put this PID 5161. I press Enter and look at Firefox here and here. Woo, killed by a force is gone, and that was actually killed. Okay, if I run this command again, you can see I don't have any Firefox process anymore. Now let's say I restart Firefox, okay? And I do ps, I do the same command. You can see I have the same bunch of information with a new Firefox process. But as you can also see, the PID for this process is different from the PID from the previous Firefox process, okay? So every time you start a new process, you're going to have a new PID every time. And so if you want to kill that one, I'm going to go back to the kill, but I'm going to use instead of 5422 and I can kill Firefox. Okay, so that's how you find in a process PS AUX and then maybe pipe with grip of what you want to find. And then you find the PID of the process, and then you kill dash nine with the PAD. And now I have a small exercise for you. So you're going to maybe use that terminal here to clear. In that terminal you are going to use the less command, okay, to get some text from a file, any file, it doesn't matter. So you run the less comment on that terminal. And on that terminal, you're going to find the less command from the terminal and just kill the process. So you can price pose and whenever you're ready, go to the solution. Alright, and that's the solution. So here I'm going to go to my document where I have my GPL text. I'm going to do less GPL. Okay, so as you can see, I can navigate in the file, okay? I'm going to put that on the side and I'm going to do clear PS AUX pipe grep with less. And you can see, so we have a few different processes. So those two processes actually contain less cans. You can see where the grep command, but that's not what we want. What we want is that we're less with the GPL textFile and we have the grep command also that is listed here. So now that we have found this, we have the PID here, 56 4, 3. That's the PID of that program here, that process. So now I'm going to do kill dash 95643. I press Enter and you can see killed. The less command was killed from that terminal. And if I list the processes again, I don't have the less command here anymore. 32. Monitor Space and Power Usage (df, htop): And now that you can monitor processes on your Linux operating system with a terminal, I'm also going to show you how you can monitor the space and the power usage. So first, if you want to see how much space is used, okay, on your computer, on your petition for Linux, you can use the df command and maybe use dash H, okay, for human readability. And you press Enter and that's going to show you a bunch of different stuff. But basically what you want to find is mounted on slash. That's usually going to be slash dev slash SDA, something, okay, for Linux. And you can see the size, so 29 gigabytes. So I've put my virtual machine to 30 gigabytes. And then what you have used, and what is still a label k and the percentage of what you have used it. So we just one command you can see here information on how much space do you have and how much space do you use, okay? And then another command, if you want to monitor, for example, RAM, cpu and also processes, you can use the top command. And actually I'm not going to use the top command. I'm going to press Q to exit and clear. I'm going to use another command which is htop. But as you can see, htop is not installed. So you can install it either with APD. Are we snapped if you want to. I'm just going to use APT here. So the APT install htop. So you put the password, you install the software. Okay, that's done. And then you do htop and you have a much better interface. So you can see here on the top, you have basically the two CPUs to have two CPUs for my virtual machine here, for Linux. So I have two CPUs and the usage of all CPUs. So if you have more, you're going to see more of that. And then here is the ram. So how much of your RAM is actually used, okay, you can see in green and then the cash, okay, So how much of the RAM is used? Number of tasks, number of traits, etc. The uptime and many more information here you can see with all the processes. So that is also a way to get all processes running. You can see we have the htop process here, which is running with the PID 63178. You can also press 5 to get. And you can see here like this, better view, okay, with a tree system. And then you can also find and kill processes from that if you want to. So I'm going to start Firefox again from that window of k. And well, you can just go in that window and just find Firefox so you can just crawl. Or you can also do f x3, okay? Type Firefox. Okay, Enter and you're going to get, okay, You can see Firefox. So that is, you can see that is the process. So you have many different processes, but actually that's the one at the root here. That is the process of Firefox, this PID. So now you could use the kill command and another terminal, which can also kill it directly from there. Or you can see F9, so you press F9. Okay. And then you can press Enter. And you can see the Firefox has been terminated or killed here. And if you want to quit htop, you just press Q on the window and you are back to the terminal. So that's a super useful tool that I use all the time. All right, so now you know how to monitor the usage of resources on Linux and also how to monitor, find, and kill processes directly from the terminal. 33. Discover Basic Network Commands (ifconfig, hostname -I, ping, wget): In this section, we are going to focus on the network functionalities you can get from the terminal. You are going to learn how to get basic information. Check that you can connect to different websites and devices, download some pages from the internet and get a remote connection to a Linux terminal using SSH. And let's get started. So first you have a comment that is named hostname. So how's name is going to give you basically your host name. Okay, So nothing special about that. But then you can do host name, dash I, uppercase. And this is going to give you IP address that you have on the network. So for that specific machine, so for example, for your Linux operating system running on your computer, are here in the virtual machine. You will have a IP address or host name dash. What you can also do, I'm going to do here. You can do IF config and the ifconfig command is going to give you more information, but as you can see, we need first to install it from that package. So sudo APT install net tools. And I just installed the package. And now you, if config and you can see I have information about the different interfaces I have on the network. And which one you will always have is the loop back here you can see, so this IP address is the loopback that you will have for any machine. And then you can see here, I have also the IP address. I can find the IP address here from the methods, the same one. So depending on your network configuration and here's a virtual machine or dual boot. You may see different interfaces here, for example, Ethernet and WiFi with w. If we do that here you can see this. You may find ETH, for example, W LAN 0. You may find different interfaces and for each a bunch of information. And basically one of the first line will contain this ionized and then an IP address here. Okay, So we're going to keep that and use that next when we connect to this machine using SSH. Now, there is a common, let's say you want to find if from that machine you can connect to a different device or from the page on the Internet. You can use pink command. So let's say I use been 10.2.15. So basically I'm going to ping my own machine. So I press Enter and you can see here you have okay, beam and you have some information every single, and then I press control C, okay, you can see that basically if you see that it's working. Now let's say instead of 15, I put a 157. So this IP address should not lead to anything on the network. And you can see, well, we don't have anything, okay, destination, host, unretrieved for so we've pin, you can make sure that this machine and another machine can communicate through the network, or at least that they can see each other. And now let's say you want to check if you have Internet or if you can connect to an Internet page, you can do ping. And then we have a domain name, for example, google.com. And you will see that, okay, you can see you receive data from google.com. So if you have lines like this with time and the amount of milliseconds means that it's working. And so that's also a very easy way to check. If you have Internet, you may find with different comment, but you just ping Google.com. And I mean, if Google.com is not up, then we have a problem are we don't have internet. And then if you want to download something from Internet, you can use what we have seen before, W get command with a web page. So for example, if you want to download google.com, you can, okay. And you can see here it was downloading into index.html here, right here. And so you have, let's do less index dot HTML. You can see that's the code you have on Google.com. So that's kind of impossible to read now, but, well, you have downloaded the page here, the HTML page of google.com. And you can download the TXT files, you can download applies, you can download many things with W gets. 34. Remotely Connect to Your Linux Terminal Using SSH: Let's now see how to remotely connect to your Linux terminal using a stage. Okay, so I'm going to show you the steps that work for basically any Linux. And then I'm also going to show you because this is a virtual machine. So I'm going to use a specific configuration you have to do if you want it to work on VirtualBox. So first you open a terminal and you can just do sudo APT. So we're going to install a new package, installed open SSH dash seven. Put password and you install this, so yes. Okay. And once you have installed that, you don't need to do anything else. Ssh will be enabled on that machine and then you can connect to SSH. So don't forget to run that first. And then, well, to connect using SSH to that machine. So you need to connect from another machine. So for example, from another Linux with another computer, or from another virtual machine, also directly from Windows. Okay? And one thing that's one parenthesis I'm going to do here is that you need to change a setting in the network setting of your virtual machine here if you want it to work. So I'm going to shut it down or of meshing in the settings here of my virtual machine. I am going to go to network. And basically that's an a T. I'm going to put host only adductor. Okay, I'm going to click on, Okay, and I'm going to click on, Start again. And back to the virtual machine and when to just simply open a terminal and do hostname dash. And you can see that the IP address we have here is different from the one we had previously. Now we have a 192 dot 168, etcetera. Okay, That's one IP address that is going to work for what we want to do. Because with the previous setting, the thing is that the virtual machine was not reachable from the outside. Okay, so we had to change one setting in the network. So then we have a different network settings, will also have a different IP address, and we will be able to reach this machine from the outside. Now the only problem here is that when you do that, you don't have Internet anymore in your virtual machine. So you will be able to connect to SSH but not get internet. For that, you will need maybe to do some other specific settings that are more complicated. And basically after that, if you want to connect with SSH to a machine, you're probably going to, going to connect directly to machine running Linux and not to a virtual machine. So what I'm going to do now that have this IP address, I'm going to open a terminal from another machine. So for example here on Windows, I have open a terminal, so that's the, the Windows Terminal. Okay. I'm doing that on Windows because, well, we're doing Linux costs actually, but the SSH command is the same for Windows, Linux, and Mac. So I'm just going to come in here. And that's the same if you want to connect from any other machine. So what I'm going to do, I'm going to do SSH and then put the user I want to connect to. So SSH aid because the user at and then the IP address, a 8200685600102. I press Enter. Okay. And you can see, are you sure you want to continue so you have to price, you have to select Yes here. And then put the password of the user, add p.sit, press Enter. And you can see, welcome to you will do. And we are actually connected as the Edge user on the ad VM host. So in that terminal from a different machine, okay, whether it's Windows, Linux, and macOS, I can directly connect to that Linux using SSH. So that's a remote connection. So here I'm using the same computer, but that could be on a different computer on the network. That could be somewhere else. And if I just have access to it and I can connect to SSH, well then I can have access to the machine. So now I can do for your Alice, you can see I can list everything and let's say I create a new file. So touch new file here in my home directory. If I go back to my virtual machine, I do ls. I have the new file in my home directory. Okay, so here it's the exact same thing as if I was connected in the terminal, in my Linux host. And so you can see that when you get access with SSH, so you get a remote connection, but well, you just get a terminal, okay, you don't get all the graphical utilities. So that's where it's super important to know how to use the terminal when you are going to remotely connect to another machine with SSH, you're only going to have the terminal. That's it. And if you want to exit from that, if you want to quit from the SSH connection, you just do exit and you are back to what you were doing before. So here I'm back to Windows Terminal and you can see Connection Close. All right? And so now I'm going to close my virtual machine and make sure that if you want. So I'm going back to settings and network. If you want to get Internet, just choose an 80 OK. And host only if you want to be able to connect to SSH to that machine. All right, so that's the end of this section on networking with the terminal. You are now able to find the most useful information related to the network with the command line tools. And you can also get a remote connection to any Linux machine using SSH. 35. What to do next: Congratulations, you have just finished the course. You now have a strong foundation with the Linux command line. We'll discuss in a little bit more practice. You are going to be very confident using a terminal. And if it's not already the case, you will start to use the terminal for anything you need to do. Because that's just faster, simpler, and you usually get more options than using a graphical interface. Now, how to go further from now? The thing is that using the Linux command line is not the end of it. This is more of a means to an end to help you when you work on Linux systems. So what I recommend you to do now, instead of just learning Linux for the sake of it, is to work on various projects where you're going to use Linux. For example, you may want to study our work in web development, system administration, ethical hacking, robotics, etc, etc. Almost any project or job related to software or administration is going to require you to use Linux. There's no The common line. So study or work on a project in a field where Linux is a requirement and that alone will make you practice on the common lines you've seen and discover more of Ben. The best you can do is to combine real life projects with the use of the terminal, having a context to walk on, we make you progress much faster. And of course, all along the way, stay curious and continue to learn more. Also, don't hesitate to search on Google whenever you have a question or you don't know how to do something. Actually, searching on Google is a real skill that is often underestimated. But it is actually one of the most important skills you can have. If you ask any people working on Linux what they do in a day, including me, they're going to say to you, well, I searched on Google. So well, to recap on all that, find yourself a real project or study something that requires the use of Linux. From that experience, you're going to practice more with the common line. Also continue to be curious and don't hesitate to search on Google. And now, Well, it's time for me to say, thank you for following this course until the end. And I hope to see you soon.