Coding agents like Claude Code and Codex do their work by running commands in your terminal, so learn enough Bash to read a command before you approve it.
rm -rf deletes a file or a whole folder for good. The terminal has no recycle bin, so check the exact path before you approve it.
Slow down when an agent's command uses sudo or pipes curl into bash. Ask why when it reads or changes files outside your project folder.
Start your coding agent from your project folder, because it treats the folder you launch it in as its workspace.
Never run an agent with --dangerously-skip-permissions on your real machine. It doesn't know which of your files are private and won't ask before reading them.
The terminal is a window where you type commands instead of clicking around, and it's where coding agents like Claude Code and Codex do most of their work. If you build apps with AI, you need enough Bash to read the command your agent wants to run and decide whether to approve it.
This page covers the handful of commands that do most of the work, the red flags that should make you stop and look, how to check a command you don't understand, and why I never let an agent skip permissions. The video above covers the same thing.
Who this is for
This is for complete beginners and non-technical people who build with AI. If you already code and use a terminal every day, you won't find anything new here.
Why the terminal matters now
When you give a coding agent a task, it doesn't click buttons for you. It reads and writes files, and it runs commands in your terminal. Some of those commands are long, and if you can't read them, you have no idea whether one is a normal step or something that wrecks your machine.
A command doesn't have to delete anything to be a problem. It can read your .env file or some other file full of API keys, and then that data goes to the AI company's servers. Unless you know what a command does, you can't tell whether it's safe to run.
A terminal is the opposite of a GUI. In a GUI you point and click. In a terminal you type a command, press Enter and read what it prints. Every operating system has one: search for "terminal" in your start menu or Spotlight and it opens an empty window with a prompt.
Bash on Mac, Linux and Windows
The language you type commands in is called the shell, and the one I use is Bash. Linux uses Bash by default. Macs have used zsh by default since macOS Catalina (2019), but every command on this page works the same in zsh.
On Windows, install WSL (Windows Subsystem for Linux). It runs Linux inside Windows, so you get Bash. Open PowerShell as administrator and run:
wsl --install
Restart when it asks, then open the Ubuntu app it installed. Microsoft's WSL install guide has the details.
The alternative on Windows is PowerShell, which is a different language with different commands. I'd ignore it. Unless you're building something specifically for Windows, you'll almost never need it, and the commands your agent runs and the answers you'll find online are mostly Bash.
The commands that do most of the work
A small set of commands covers about 80% of what you'll do in a terminal, and of what your agent will ask to run. Open a terminal and type these along with me.
Make a folder and move around
mkdir cli-demo
cd cli-demo
pwd
mkdir makes a directory (a folder). cd stands for change directory, so cd cli-demo moves you into it. pwd prints the folder you're in right now, which is the first thing to check when something looks off.
cd ..
cd ~
cd ~/cli-demo
cd .. goes up one folder. cd ~ takes you to your home folder (~ is short for it). To get anywhere else, give cd the path, like cd ~/cli-demo (a new terminal opens in your home folder, so that's where cli-demo ended up). If the screen gets cluttered, type clear.
Create and list files
touch file1.txt file2.txt
ls
ls -la
touch creates empty files. ls lists what's in the current folder. ls -la lists it with details: -l adds each file's size and date, and -a includes hidden files, the ones whose names start with a dot. Your .env file is one of those, so plain ls won't show it.
To put some text in a file, open it in a terminal text editor. I use Micro (micro file1.txt); nano comes with most systems. After I wrote "This is some random text." into file1.txt, ls -la showed it at 26 bytes and file2.txt at 0:
-rw-r--r-- 1 hassan hassan 26 Nov 11 16:40 file1.txt
-rw-r--r-- 1 hassan hassan 0 Nov 11 16:40 file2.txt
Copy and move files
cp file1.txt copy-of-file1.txt
mkdir backups
mv copy-of-file1.txt backups/
ls backups
cp copies a file to a new name or into another folder. mv moves it, so after the mv the copy is gone from cli-demo and sits in backups. mv also renames: mv old.txt new.txt.
Delete files and folders
rm file2.txt
rmdir backups
rm -rf backups
rm deletes a file. rmdir deletes a folder, but only an empty one, so here it fails with rmdir: failed to remove 'backups': Directory not empty. That's a safety check.
rm -rf skips it. -r (recursive) deletes the folder and everything inside it, and -f (force) never asks for confirmation and doesn't complain if the path doesn't exist.
There's no recycle bin in the terminal. A file you delete with rm is gone, and you won't get it back. Only use it on files you actually want gone, and be very careful when your agent asks to run it.
Read files
cat notes.txt
head notes.txt
head -n 3 notes.txt
tail -n 3 notes.txt
For these I made a notes.txt with twelve lines, "line one" to "line twelve". cat prints a whole file, exactly what you'd see if you opened it in an editor. head prints the first 10 lines, and -n 3 changes that to 3. tail does the same from the end of the file.
grep searches a file for text and prints every line that contains it. -n adds the line numbers, which is how an agent finds where to edit:
2:line two
3:line three
10:line ten
12:line twelve
find searches for files. The . means "start in the current folder", * is a wildcard that matches anything, and -iname matches the file name without caring about upper or lower case. In my test folder, -iname "*.tsx" found both App.tsx and Button.TSX, while -name "*.tsx" only found App.tsx.
Download from the internet
curl https://example.com
curl sends an HTTP request to a URL and prints what comes back, here the HTML of the page. It's a command-line HTTP client, so it can send POST and PUT requests too. Your agent uses it to read web pages and download scripts, which is why it shows up again in the red flags below.
There are more commands worth knowing, like less, chmod, which and echo. I keep them in a command line cheat sheet with an example for each.
Start your agent in the right folder
When you launch a coding agent from the terminal, it treats the folder you're in as its workspace. Start it in your project folder:
cd ~/projects/my-app
claude
If you launch it from your home folder instead, it doesn't know which project you mean and treats your whole home folder as its working area, which is not what you want. Run pwd first if you're not sure where you are.
Red flags in an agent's command
Once the agent is working, it asks your permission before running commands. Most are harmless. These are the ones where your spidey sense should start tingling:
Pattern
What it does
What to check
rm -rf
Deletes files or whole folders for good
That the path is exactly what you expect, with no stray space or *
sudo
Runs the command as administrator, with power to change or delete anything on the machine
Why it needs admin rights at all
curl ... | bash
Downloads a script and runs it straight away, without you reading it
Where the script comes from
A path outside your project
Reads or changes files the project doesn't own
Why it needs that file
The last one is easy to miss. If I'm in my obs-scene-switcher folder and the agent wants to read something in ~/.ssh or another project, I want to know why it needs a file that isn't part of this project.
For curl | bash, the safer route is to save the script to a file with -o, read it, and only then run it:
curl -fsSL https://example.com/install.sh -o install.sh
less install.sh
bash install.sh
Ask an LLM to explain the command
Once you've ruled out the obvious red flags, you still need to understand the command. My probably controversial take: copy the whole command, paste it into ChatGPT or Claude in a new conversation, and ask:
Explain what this command does, step by step, and tell me
the worst thing that could happen if it's wrong:
<paste the command here>
That gives you a breakdown of each part and the worst case, and you decide whether it fits what you asked the agent to do.
This only works because you learned the basics first. If you don't know what rm -rf or a pipe does, even a perfect explanation won't help you make a good call. With the basics, you'll have your own read on the command before you paste it, and the explanation fills in the parts you didn't know.
Never skip permissions on your real machine
Claude Code has a --dangerously-skip-permissions flag, and Codex has --dangerously-bypass-approvals-and-sandbox (alias --yolo). Both let the agent run any command it wants without asking you first.
Don't use them on your real machine. You never know when a model is going to run something stupid, and it doesn't even have to destroy anything. Say Claude wants to read a file to understand your project better, and that file is a private document about your company that you don't want on Anthropic's servers. Claude doesn't know it's private. With permissions skipped, you never get the chance to say no.
These models don't run stupid commands all the time, although that's a real possibility. The bigger problem is that they don't have your context, so they don't know what's right and wrong for your business.
So learn the basic commands, watch for the red flags, ask an LLM about anything you don't recognize, and keep the permission prompts on. Then play around in the terminal and run your own commands. Do that and you'll be fine using a coding agent on your machine.
Video transcript
ShowHide
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 Claude 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 Claude 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's 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 ..`, it's going to send me to the directory above this. If I press or if I type `cd ~`, 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 bunch of empty files over here so I can show you a bunch of other 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 the file contents in this folder.
I use 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 file1.txt has like 25 bytes of storage over here, whereas file2 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 more commands. We can run `cp` to copy a certain file and place it in some other destination, like, I don't know, copy of file1.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 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 `-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 files that you actually want to delete because remember, if you run this, 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's 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 codebase.
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 Dockerfile. 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 Dockerfile. 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, `-iname`, a wildcard, let's say, `*.tsx`, and it's going to find all of these different files that end with the `.tsx` extension. Why? Because I added a wildcard over here, right? And also because I passed `-iname`, 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 of really 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 codebase. 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 spidey sense should start to tingle, and you should start to, like, really look at the command and see, "Hey, is this needed? Like, 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're running it as an administrator. If you're 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 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 ChatGPT or Claude and just ask it to explain it to you. Like here we have a terminal running Claude, 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 ChatGPT 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 Claude 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.
Share this article
Link copied!
Share it on Instagram.
Dude, you’re at the bottom of my landing page.
Just book a call already if you’re that interested.