Auto-generated transcript Hey, in this video, we're going to talk about the CLI, the command line interface. I'm going to walk you through exactly how it works as a complete beginner, so that you can one, understand exactly what your AI agent is doing when it's running this really long command. And to run your own commands yourself so that you can really see how a CLI is better than something like a GUI or something. And three, well, there is no three, let's just get into it. And if anyone's wondering why my hair looks like a mess, I just got out of the shower. So yeah, ignore that. The point of this video is that when you're using an AI agent, when you're using some coding agent like cloud or codex or whatever, and you give it some task, it's obviously going to run a bunch of commands, right? It's going to read and write files, write some code and all that. And it's also going to run a bunch of commands in your terminal. The only problem is if you're a non-technical person, if you don't know how these things, like how computers work and how programming languages work and all that, you probably can't read commands like these, right? And you don't know whether this is safe or not, whether you can safely run this, whether it's going to destroy your system, or it's just a normal command. And it doesn't even have to be a completely destructive command. It could also just be a command that reads a sensitive file, like an environment file, or your API keys or secret file. And then that data gets transmitted to cloud servers, and then their models can train on your sensitive data. Like unless you know exactly what these commands are doing, you don't really know whether they are safe to run or even convenient to run. And so that is the point of this video. It's to help you become more familiar with the CLI, help you become more familiar with the terminal, and to read commands like these and just decide whether they are safe to run or not. I should also mention this video is geared towards complete beginners and complete non-technical people. if you're someone who already knows how to code and if you're already regularly using these AI coding tools and all that you probably shouldn't be watching this video at all because this is completely designed for beginners I'm going to talk about how to use a terminal how to run basic shell commands and how to decide whether your AI agent's command is safe to run and whether you should run it or not right so right off the bat if you're already a very technical person if you're already comfortable using a terminal, you probably should not watch this video at all. You should click off and save your time because I'm not going to discuss anything advanced over here. This video is strictly for beginners and non-technical people. Let's get started. Now, by the end of this video, my promise is that you're going to be able to run basic commands on your own in the terminal. You're going to be very comfortable working inside a terminal environment. You're also going to understand all the basic shell commands that are kind of like the 80-20 of terminal commands. Basically, if you know all of these basic commands, then you can do like 80% of all operations inside a terminal, right? Just by, you know, mixing and matching these basic commands. And you're also going to learn whether you should approve or reject a certain command that cloud or codex wants you to run or wants your permission to run itself. Next, every single operating system, no matter what you're using, has some sort of a terminal, right? whether that's Windows, Mac, or Arch Linux. Now I'm on Arch Linux over here and this is my terminal environment. If you're on Mac or Windows it'll probably be slightly different but no matter what you're using you can follow along with this video because every single OS has a terminal environment that you can open up and run some commands in. Now inside a terminal the language that we use to actually write these commands that actually matters a lot as well and the one I'm using over here in Linux is called Bash. I can run commands like these and, you know, it'll do certain things. Bash is the default language in Linux as well as macOS. So if you're using either of these two platforms, then you can follow along in this video. But if you're using Windows, you need to install a little something called WSL. WSL stands for Windows Subsystem for Linux. There's a great Microsoft help article over here that shows you how to install WSL. Just follow along with this and you'll have basically a Linux virtual machine running inside your Windows operating system. And once you have this, you can basically run Bash inside that Linux VM, basically, right? And the reason I want you to do this is just so you can get Bash as a scripting language to follow along in this video. Because the alternative on Windows is using PowerShell. PowerShell is a completely different technology. It's a different language. And it's also a very horrible language. It has pretty much no, like zero use in real world scenarios unless you're building specifically something for Windows, which very few people are. If you're a non-technical person and you are just trying to build some app, you probably should not even be thinking about PowerShell. So if you're on Windows, get WSL, get Bash, ignore PowerShell. If you're on Mac or Linux, Bash is already the default So you can just follow along with this video Now let talk about what a terminal even is right As you can see this is a completely empty terminal window that I opened up over here And no matter what OS you on you can just go over to your start menu or something and just type something like terminal and it should open up something like this as well, right? Now this is pretty different from a graphical user interface, right? Because over here, you're supposed to type commands and run them instead of, you know, pointing and clicking with a mouse, right? Which I know sounds completely okay so this is what a terminal looks like right and i can run commands over here and you know that does stuff it's obviously different from a gui where you are supposed to just point and click to whatever you want to press or do right and the reason clis are even becoming so much more important nowadays even for non-technical people who don't even know what these things are is because of ai agents right it's because i can launch a coding agent over here and give it some task and it's going to go do that task. And in order to do that task, it's going to run a bunch of commands, like, you know, just some basic bash commands so it can do various different things, right? And so unless you want to just completely give all autonomous control to a coding agent and just let it wreak havoc on your machine, you probably want to understand how these things work under the hood. And so with that being said, let's learn about a bunch of different basic commands that you can use on bash and that you should probably be familiar with i'm going to run mkdir to create a new directory over here this is just to create a new folder we're just going to call this cli demo then i'm going to use cd which stands for change directory and go inside that folder oh and if you missed that i just typed clear which basically just clears the terminal screen if i run a bunch of commands and then i press clear it's going to just clear the terminal just gives you more room to work with, right? I should probably explain how the CD command works a bit more. If I press or if I type CD and then two dots, it's going to send me to the directory above this. If I press or if I type, I don't know why I keep saying press CD and then this little letter, it's going to send me to my home directory. And then if I want to go back to my original folder, I'll just give it the path to that folder, press enter. And here I am. Now let's create a a bunch of empty files over here so I can show you a bunch of other um commands I'm going to run the touch command this is just to create new empty files then if I want to list the contents of a directory I can just say LS and it's going to show me all the files that are in this folder I can also type ls-la to get even more details about this about the file contents in this folder I something like a terminal text editor called micro pass in a file path and it'll open up that file for me to write some text in like I don't know this is some random text save that let's print the contents of the folder again and you can see that file 1 dot txt has like 25 bytes of storage over here whereas file 2 has 0 and that's because we literally just wrote a bunch of text in it right now right now let's run a bunch of more commands we can run cp to copy a certain file and place it in some other destination like i don't know um copy of file one dot txt and we have that copy right here i could also you know place this in a completely different folder or something by just passing in the path to that folder for example i could create a backups folder. And now let's try moving a file. To do that, we can press we can type, we can type MV, I'll just move the copy that we just created into the backups folder. Now if I run LS again, you can see that that file disappeared from over here, but we do have a backups folder. So let's run LS on that. And you can see that the file is right there. Now, if I want to, let's say delete a file, I can run RM, pass in the file path, and it'll delete it. I can also run rmdir to delete a folder. And it's going to give me an error because the directory is not empty. Obviously, this is just a safety measure. So how about we pass in a force flag just to and also another way to delete a directory is to just use the rm command. This isn't just to remove a file, it can also remove directories, if you pass in the dash RF flags over here, and then I can pass in a folder path and it's going to delete that folder for us. Now I should note that the rm command doesn't you know have a recycle bin or a trash folder where you can recover files from. If you run this command to delete a file that file is permanently gone. You are not recovering it no matter what you do. So be very careful running this command. Always use it to remove you know files that you actually want to delete because remember if you run this you the file isn't going it's going to be permanently deleted off of your operating system, right? So just be careful running this command And be very careful when your AI agent gives you a command like rm and you know asks you to approve that command Now let talk about a bunch of commands to read file contents So for this, I'm going to go into a completely different folder. Let's go into my website folder. So here I am in this entire code base. I could run something like a cat command. This is going to print the entire file contents of any given file. let's use it to print my docker file as you can see this is the entire file content right if you open this in some text editor this is the content that you would see over there let's clear the screen i can also run something like head this is going to print the first initial lines of a file let's pass in the same file and as you can see it prints the first couple of lines of that file right the opposite of this is tail which is going to print the last couple of lines of a file as you can see over here. Let's clear again. Some more really cool commands. One of them is called grep. This is used to search a file for some particular text or string. So let's say I want to search for the string node inside my Docker file. It's going to show me exactly where that string is, right? There's also a really useful command called find. This is used to just search for files inside some folder or something. I could pass in something like find in the current directory. That's what that dot is for dash i name a wildcard dot let's say tsx and it's going to find all of these different files that end with the dot tsx extension why because i added a wildcard over here right and also because i passed i name which just basically means match by the file name just with case insensitivity so yeah all these different little command flags and customization options that you're going to have to learn but i'm just giving you a basic overview of what these commands actually do and how they work. Another useful command to know is called curl. This is going to take some sort of a URL and you can send HTTP requests to that URL, something like, I don't know, example.com or something. It's going to go and fetch that entire page or that website for you. You can use different request methods like post, put, all those other things, right? It's basically a command line HTTP client for you to send HTTP requests from. It's a pretty big deal because your AI agent is often going to use this to grab website content from the internet and also to download scripts and to run them, right? So you need to be careful with this command. If you're running some third-party script that you just downloaded and you're just executing it on your computer without actually reviewing it, that could be very, very dangerous. And depending on your appetite for risk, it's probably something you should be aware of. There's a bunch of other commands that we should probably go over as well, but this video will probably get like an hour long if we went through every single one. So what I'm going to do is there's going to be a cheat sheet in the description of this video that you can check out. And that's going to cover all of the basic commands that I wanted to cover in this video. We've gone through all of the really important ones, but there's a couple like really like niche ones that you should still probably be aware of. but I just want to save your time and talk about the more important stuff which is how to know whether your AI agent is running a safe command or not. Now one thing you should also be aware of when you start a coding agent inside some CLI make sure you're in the right project directory as well. So as you can see over here I'm in my website code base. If I want to work in this project then this is the place to be but if I'm in some other folder let's say I'm in my home directory and if I run my coding agent over here it's not going to know which project I'm working on right it's just going to treat my entire home directory as its working area which is not what we want so if you're running a coding agent from your CLI make sure you're in the right path so I'm in one of my projects over here and I'm just going to launch a coding agent right here and if you're wondering what this OBS scene switcher is it is basically the gnome extension that I'm using over here to help record my videos. Now, if I gave this coding agent a prompt to go and do some certain task, it'll ask me for a bunch of like shell commands that it needs to run, it'll ask my permission for it, right? I need to figure out whether those commands are safe to run or not. So there's two ways to actually figure that out. The first one is to just be very mindful of the most common red flags in a shell command. And if your agent tries to run anything like this, like your your spidey sense should start to tingle and you should start to like really look at the command and see hey is this need like is does this need to run or not because this is looking really dangerous anytime your agent runs something like rm-rf be very careful this is going to permanently delete some file or some folder and you need to be very careful that it is pointing towards the right thing you could lose a lot of important data with this if you're running something with sudo sudo just means that you running it as an administrator if you running any command with sudo you have the power to do anything on your machine anything at all even destroy the entire machine, right? delete all the files, just nuke the entire thing. so if you ever run a command with sudo, or if your agent tries to run a command with sudo, be careful and be very like vigilant about what it's actually doing. if you're running something like curl and then piping the output to bash, like if your agent gives you a command where it's, you know, using curl to fetch some sort of file or web page from the internet or some script, right? And then it pipes that output to bash. Be careful because what this is doing is it's downloading and running a script from the internet that obviously you haven't read. And this script could do something potentially pretty terrible on your machine and you don't want that, right? And finally, when the agent asks you to run a command that operates on any path or any file that is outside the project folder, right? You can see over here in my terminal that I'm in the OBS scene switcher directory, right? Right here in the bottom left corner. If the agent tries to modify a file or to read a file that is not inside this folder, that is outside the project scope, that's a red flag, right? That's the point where you should wonder, hey, why do you need to read something that's not even part of the project, right? So be very mindful of these common red flags. And then once you've, you know, ruled out the obvious bullshit, the next thing you need to do is actually understand the command, right? And so here is my probably controversial take on how to understand an unfamiliar terminal command. Literally just take it and then place it in chat GPT or cloud and just ask it to explain it to you. Like here we have a terminal running cloud and you gave it some sort of a task and it's going to go do that task and it wants to run this command, right? How do you know whether you should allow it or reject it? You literally just take the entire command, place it into an LLM or coding agent in a new conversation or something and just ask it to explain this command and what's the worst thing it could do if it's wrong, right? This is going to explain the entire command. You'll understand how it works. You'll understand what it's doing and you'll also understand whether it is, you know, whether you should run this for your specific needs or not. Now, the reason you can't do this without first understanding all of the stuff that we talked about before, you know, all the basic commands and stuff, is because if you're a complete noob to all of these different things, even if AI explains the entire command to you, it's like you probably won't be able to make a good decision until you actually understand how commands work under the hood, right? and so that's what the previous 20 minutes was for just to explain to you how terminals work how basic shell commands work so that when you encounter an unfamiliar command like this one you're going to have your own you know thoughts about this command and what it's supposed to do but two once you paste it into chat gpt and ask it to explain it to you you're going to have a bunch of preliminary knowledge inside your brain that helps you to understand what this particular command is going to do because you already have a pretty solid foundation of how terminals and how shell commands work. So yeah, that's how you decide whether you should approve or reject a command. One final thing I'll leave you with, don't ever use dangerously skip permissions on your real machine, right? For those of you who don't know, this is basically a configuration option in Cloud Code or Codex that allows these AI bots to completely skip all of the permission checks and just execute whatever command on your machine that they want to. They can pretty much take any action they want on your machine. And you don't want that because you never know when they are going to run something completely fucking stupid. And even just, you know, it doesn't even have to be something that destroys your whole machine. It can just be something innocent. Like maybe Claude just needs to read a file to understand your project better. But the only problem is that Claude, that that file is a very sensitive document that details private information about your company, and you don't want to send that information to Anthropic's servers. But Claude doesn't know that that's a private file, and he's just going to try and read it. And if you use flags like this, you're never going to have the opportunity to approve or reject those commands. It's just going to run them automatically without even asking you for approval. So don't use dangerously skipped permissions. It's not that these models are going to run completely stupid commands, although that is a very real possibility. It's that they don't have all the context you do, and so they don't know what's right and what's wrong for your unique business use cases. And so, yeah, that's the video. Don't use dangerously skipped permissions. Ask an LLM to help you understand different commands that the agent wants you to run. Be very mindful of the common red flags that we discussed, and just play around with the terminal, run your own commands, learn how basic commands work, and you're going to be completely safe anytime you're using a coding agent to do any sort of work on your machine. Hope that helps.