**Navigating the Terminal: A Step-by-Step Guide**
As we begin our journey through the terminal, it's essential to understand how to navigate this powerful tool efficiently. Our first step is to open up our terminal and get familiar with its interface. In our regular terminal window, we can see a list of available directories and files using the `LS` command.
**Changing Directories**
To change into a different directory, we use the `CD` command followed by the path we want to navigate to. For example, if we want to go to our desktop folder, we would type `CD desktop`. The `CD` command stands for "change directory," and it's essential to understand that each directory has its own set of files and subdirectories. By using the `CD` command, we can switch between these directories and access the files we need.
**Autocompletion**
One of the most useful features in our terminal is autocompletion. When typing a file name or path, we can press the `Tab` key to see a list of possible completions. For instance, if we type `CD lern Py` and press `Tab`, the terminal will suggest `LearnPython_oop`. This feature saves us time and reduces errors by providing a list of potential matches.
**Creating a New File**
To create a new file in our current directory, we can use the `touch` command followed by the name of the file. For example, to create a new file called `hello.py`, we would type `touch hello.py`. The `touch` command creates a new empty file with the specified name.
**Running a Script**
To run a script, we need to navigate to its location using the `CD` command and then use the `python` command followed by the filename. For example, if we created a file called `hello.py` in our current directory, we would type `python hello.py` to run it. The output of the script will be displayed on the terminal screen.
**Writing Code**
Now that we've covered basic commands and navigation, let's write some code! Suppose we want to create a loop that prints numbers from 0 to 10. We can write this code in our `hello.py` file using a programming language like Python. The output of the script will be displayed on the terminal screen.
**Using Shortcuts**
To improve our productivity, it's essential to learn and use keyboard shortcuts. One crucial shortcut is `Alt + Tab`, which allows us to switch between open windows and applications. Another useful shortcut is `Command + Tab` (on Mac) or `Control + Tab` (on Windows), which enables us to cycle through open applications.
**Customizing the Terminal Interface**
The terminal interface can be customized to suit our preferences. We can resize the window, make it appear in a different location on the screen, and even adjust its size. By doing so, we can create an efficient workflow that combines both the terminal and our text editor.
**Final Tips**
As we conclude this article, I encourage you to take advantage of these shortcuts and workflows. By mastering the terminal, you'll save time and become more productive in your coding endeavors. Don't be afraid to experiment and adapt these techniques to suit your needs. Remember to leave comments below if you have any questions or need further clarification on any of the concepts discussed.
"WEBVTTKind: captionsLanguage: enhey guys so here's what I want you to do for your code and how you should run and how you should follow along for like kind of all of the exercises okay so first of all um I'm using py charm for now if you aren't familiar and really comfortable with the command line don't use the software okay you can use it at a later point but for now I want you to use something called Sublime text okay because this will let you kind of practice your Ninjutsu uh in the command line okay so it's like a good workout and you will become a ninja trust me just don't don't use this for now you Sublime Text and here's how you're going to I I want to just teach you a fullon method and how you can actually have a your own workflow and your working environment how it should look so this took me years to figure out okay so I'm giving you really good pearls here now what I'm going to do is let's say go to wherever you want to do this okay so maybe go to Learn Python or clever programmer or on your computer you might have some other folder on your desktop okay some people like to do it on the desktop let's just do it right here so right on my desktop I will do this okay I will actually why don't we just kind of do it live right um I'm going to create a new folder here and I'm going to call it uh python O Okay Learn Python oop and I'm going to put it right over wherever you can put it whatever I'm just uh really crazy about keeping it clean all right so inside of this folder you can you know open up a new thing or just open up Sublime so you can just open up Sublime Text it's not related to that particular folder now I have a window management system that I'm paying money for that allows me to really quickly put my windows in a neat way if you don't have it that's fine just do it manually I'm using something called spectacle a lot of people ask me about this and by doing this you can see that everything is set up to the left hand side here okay and so here I'll write my code and I'll save that file in Learn Python oop okay and I'll show you how to do that step by step so I'm going to make this really huge so you can see it clearly and let's just write hello world okay that's actually a little too huge it's not in any colors right now cuz it doesn't know what language you're using but once you tell Sublime Text it's extremely intelligent and it'll figure it out so I'm going to go to desktop and I'll go to Learn Python oop and I'm going to change the name of this this file and we'll call it example.py okay or hello whoops hello world. py and now you can see that it's saved right there okay all right now what you want to do is actually know how to run this file okay how do you actually run this code we're going to open up terminal so you can open up your terminal terminal on your Mac um I have I terminal it's a little fancier one so if you want to go ahead and install that go ahead on Windows you're going to probably have to stick with Git bash which is still a pretty it's it's pretty good like just make sure you go online and download it it doesn't come built in with the windows cuz the Windows command prompt really sucks so you need a Linux command line system so if you actually look up on Google get bash and download it you should uh essentially virtually have a full you you'd be able to follow along the course okay now I'm going to open up my terminal okay so I term again you can open up your uh ter regular terminal go away all right so I'm going to bring this over and I've set it up all the way to the right side all these notifications okay so from my terminal I'm going to go to that Learn Python on o folder on my desktop so follow along and see how I'm going to do it first of all I'm going to hit LS which is list directory so it's essentially like me looking around the room and seeing what's around me I notice desktop so I'm going to say CD desktop CD means change directory so now I am in my desktop so essentially I am right here this is where I am now okay um this just doesn't have a graphical user interface but you're still pretty much traveling the same way you are with the mouse all around your computer now what I want to do is I want to go to CD Learn Python oop and by hitting tab it autocompletes it for me okay if you don't hit tab you'll have to write this whole thing but you will get an error guaranteed because it thinks learn is one command python is another command and O is another command so one good practice to do is never name your files on your computer with spaces just like separated by something like uh underscores okay so just put an underscore there and put an underscore there okay now when I autocomplete this and I try to go there you see it puts underscores there for you let me hit LS again underscore so just one name now all right now let's hit change directory and if we hit LS what do you expect we will see well we will just see what's in our folder hello world okay so I'm going to hit LS and let's just check it out and indeed you see hello world. py and now let's run this code and how we can run it is by saying python hello world. py and you can see that I've ran that code okay and how you run it normally in the normal workflows you just hit up and enter up and enter up and enter every time you have to rerun it so don't be afraid of that what you're going to do is like you're going to write some code right like let's say you you want to write a loop that goes up to 10 and prints out from 0 to 10 you're going to save it okay oh it says uh no such directory and the reason why that happened is I changed the directory on it so I got to go back to my desktop Learn Python oop and let's just do hello world. py and replace it for now that's fine and save it okay so you're going to hit save I hit command s on my computer you can hit controls these are important shortcuts okay and then what I want to do is I want to switch to the terminal screen so you can do it with the mouse but a better workflow is just hit alt tab if you're on Windows or command tab if you're on a Mac so hit command Tab and switch so you see how I'm switching between my Sublime Text and my terminal that's how you want to do it okay command tab so I'm going to hit command tap hit up and enter and you see how that code just ran and it said hello world and it did that for Loop part that I wrote now I'm going to hit command tab go back to Sublime Text and let's say I'm going to add something I'm going to say print bananas okay and I'm going to hit save because if I don't hit save the new changes don't show up I'm going to hit command tab up and enter okay I delete it save command tab up and enter okay so it's a really kind of natural workflow after you get used to it and your terminal screen if it's bothering you you can have it like smaller into the side and you can open up your text editor much wider you know it really it depends how you do it um I'll just do it half and half or maybe I'll make the terminal like in the top right um it just really how it's comfortable for you but definitely having it side by side is a better way to do it than have sublim tax save it then open up your terminal then run it very slow this is very fast very adult and this is definitely the right way to do it so there you go that's your workflow uh you can thank me later I've saved you like years of time because people just don't use these shortcuts and don't they don't take advantage of these workflows so take advantage of this and go and kick ass all right that's it for this video I hope you learn learn and are going to adapt this workflow leave in the comments below if something was unclear didn't make sense and I'll see you in the next videohey guys so here's what I want you to do for your code and how you should run and how you should follow along for like kind of all of the exercises okay so first of all um I'm using py charm for now if you aren't familiar and really comfortable with the command line don't use the software okay you can use it at a later point but for now I want you to use something called Sublime text okay because this will let you kind of practice your Ninjutsu uh in the command line okay so it's like a good workout and you will become a ninja trust me just don't don't use this for now you Sublime Text and here's how you're going to I I want to just teach you a fullon method and how you can actually have a your own workflow and your working environment how it should look so this took me years to figure out okay so I'm giving you really good pearls here now what I'm going to do is let's say go to wherever you want to do this okay so maybe go to Learn Python or clever programmer or on your computer you might have some other folder on your desktop okay some people like to do it on the desktop let's just do it right here so right on my desktop I will do this okay I will actually why don't we just kind of do it live right um I'm going to create a new folder here and I'm going to call it uh python O Okay Learn Python oop and I'm going to put it right over wherever you can put it whatever I'm just uh really crazy about keeping it clean all right so inside of this folder you can you know open up a new thing or just open up Sublime so you can just open up Sublime Text it's not related to that particular folder now I have a window management system that I'm paying money for that allows me to really quickly put my windows in a neat way if you don't have it that's fine just do it manually I'm using something called spectacle a lot of people ask me about this and by doing this you can see that everything is set up to the left hand side here okay and so here I'll write my code and I'll save that file in Learn Python oop okay and I'll show you how to do that step by step so I'm going to make this really huge so you can see it clearly and let's just write hello world okay that's actually a little too huge it's not in any colors right now cuz it doesn't know what language you're using but once you tell Sublime Text it's extremely intelligent and it'll figure it out so I'm going to go to desktop and I'll go to Learn Python oop and I'm going to change the name of this this file and we'll call it example.py okay or hello whoops hello world. py and now you can see that it's saved right there okay all right now what you want to do is actually know how to run this file okay how do you actually run this code we're going to open up terminal so you can open up your terminal terminal on your Mac um I have I terminal it's a little fancier one so if you want to go ahead and install that go ahead on Windows you're going to probably have to stick with Git bash which is still a pretty it's it's pretty good like just make sure you go online and download it it doesn't come built in with the windows cuz the Windows command prompt really sucks so you need a Linux command line system so if you actually look up on Google get bash and download it you should uh essentially virtually have a full you you'd be able to follow along the course okay now I'm going to open up my terminal okay so I term again you can open up your uh ter regular terminal go away all right so I'm going to bring this over and I've set it up all the way to the right side all these notifications okay so from my terminal I'm going to go to that Learn Python on o folder on my desktop so follow along and see how I'm going to do it first of all I'm going to hit LS which is list directory so it's essentially like me looking around the room and seeing what's around me I notice desktop so I'm going to say CD desktop CD means change directory so now I am in my desktop so essentially I am right here this is where I am now okay um this just doesn't have a graphical user interface but you're still pretty much traveling the same way you are with the mouse all around your computer now what I want to do is I want to go to CD Learn Python oop and by hitting tab it autocompletes it for me okay if you don't hit tab you'll have to write this whole thing but you will get an error guaranteed because it thinks learn is one command python is another command and O is another command so one good practice to do is never name your files on your computer with spaces just like separated by something like uh underscores okay so just put an underscore there and put an underscore there okay now when I autocomplete this and I try to go there you see it puts underscores there for you let me hit LS again underscore so just one name now all right now let's hit change directory and if we hit LS what do you expect we will see well we will just see what's in our folder hello world okay so I'm going to hit LS and let's just check it out and indeed you see hello world. py and now let's run this code and how we can run it is by saying python hello world. py and you can see that I've ran that code okay and how you run it normally in the normal workflows you just hit up and enter up and enter up and enter every time you have to rerun it so don't be afraid of that what you're going to do is like you're going to write some code right like let's say you you want to write a loop that goes up to 10 and prints out from 0 to 10 you're going to save it okay oh it says uh no such directory and the reason why that happened is I changed the directory on it so I got to go back to my desktop Learn Python oop and let's just do hello world. py and replace it for now that's fine and save it okay so you're going to hit save I hit command s on my computer you can hit controls these are important shortcuts okay and then what I want to do is I want to switch to the terminal screen so you can do it with the mouse but a better workflow is just hit alt tab if you're on Windows or command tab if you're on a Mac so hit command Tab and switch so you see how I'm switching between my Sublime Text and my terminal that's how you want to do it okay command tab so I'm going to hit command tap hit up and enter and you see how that code just ran and it said hello world and it did that for Loop part that I wrote now I'm going to hit command tab go back to Sublime Text and let's say I'm going to add something I'm going to say print bananas okay and I'm going to hit save because if I don't hit save the new changes don't show up I'm going to hit command tab up and enter okay I delete it save command tab up and enter okay so it's a really kind of natural workflow after you get used to it and your terminal screen if it's bothering you you can have it like smaller into the side and you can open up your text editor much wider you know it really it depends how you do it um I'll just do it half and half or maybe I'll make the terminal like in the top right um it just really how it's comfortable for you but definitely having it side by side is a better way to do it than have sublim tax save it then open up your terminal then run it very slow this is very fast very adult and this is definitely the right way to do it so there you go that's your workflow uh you can thank me later I've saved you like years of time because people just don't use these shortcuts and don't they don't take advantage of these workflows so take advantage of this and go and kick ass all right that's it for this video I hope you learn learn and are going to adapt this workflow leave in the comments below if something was unclear didn't make sense and I'll see you in the next video\n"