The Illustrated Guide to Local AI

Chapter 12

The Command Line, Gently

Think of the command line as a quiet room in your house. It is not a loud screen with buttons and menus. It is a simple desk where you sit alone. You type one short sentence. The computer listens. It does exactly what you ask. There is no guessing. There is no clicking around. You speak, and it acts. This room is calm. It is small. It is honest.

Start with the first five commands. These are the basics. They are like the keys you use every day.

The first command is ls. This command lists what is in the room. Imagine you walk into a kitchen. You look at the counter. You see plates, cups, and bowls. ls does this for your computer. It shows you the files in the folder. It tells you what is there.

The second command is cd. This command changes the room. Imagine you are in the living room. You want to go to the garden. You walk through the door. cd opens that door. It moves you from one folder to another. You stand in a new place.

The third command is pwd. This command tells you where you are. Imagine you are in a big house. You forget which room you are in. You look at the sign on the wall. pwd reads that sign. It says, "You are in the kitchen." It gives you your address.

The fourth command is mkdir. This command makes a new room. Imagine you have a garden. You want a shed for your tools. You build a small shed. mkdir builds a new folder. It creates a space for your things. It is empty at first. You fill it later.

The fifth command is rm. This command removes things. Imagine you have a broken chair in the living room. You take it out. You throw it away. rm deletes a file. It takes it out of the folder. It is gone. Be careful. It does not ask for permission. It just takes it.

Now, look at copying and moving. These are simple tasks.

The command cp copies a file. Imagine you have a recipe card. You want a copy for your friend. You photocopy the card. cp makes a duplicate. The original stays. The copy is new. You can keep both.

The command mv moves a file. Imagine you have a book on the shelf. You want it on the table. You pick it up. You put it on the table. mv does this. It takes the file from one place. It puts it in another. The file is not copied. It is just moved.

Reading files is easy. You do not need to open a big program.

The command cat reads a file. Imagine you have a letter. You read it from top to bottom. cat prints the whole file on the screen. You see every line. It is like reading a page in a book.

The command grep finds a line. Imagine you have a long list of names. You want to find one name. You scan the list. grep scans the file. It finds the word you want. It shows only that line. It is like looking for a key in a drawer. It finds it quickly.

Ask the computer for help. It knows many things.

The command man shows the manual. Imagine you have a new tool. You do not know how to use it. You read the instructions. man gives you the instructions. It explains the command. It tells you what it does.

Look at what is running. The computer is busy.

The command top shows the activity. Imagine you look at a clock. You see the time. top shows the time the computer spends on tasks. It shows which programs are working hard. It shows which are resting.

The command ps lists the processes. Imagine you look at a guest list. You see who is in the house. ps lists the programs running. It shows their names. It shows their numbers.

The command free shows the memory. Imagine you have a small closet. You see how much space is left. free shows how much memory is left. It shows what is used. It shows what is empty.

Now, respect two big words. These words have power.

The word sudo means full power. Imagine you have a master key. This key opens every door in the house. sudo gives you that key. It lets you change important things. Use it only when you need to. It is strong. It is serious.

The word rm -rf is dangerous. Imagine a fire. This fire burns everything. It leaves nothing behind. rm -rf deletes a folder and all its files. It does not ask. It does not stop. It does not undo. Be very careful. Respect this command. It can erase your work.

Installing things is like shopping. You need tools.

The command apt is the store. Imagine a hardware store. You buy a hammer. You buy a screwdriver. apt brings new tools to your computer. It installs programs. It updates them. It keeps them fresh.

The command pip is the store for the kitchen. Imagine a kitchen store. You buy a whisk. You buy a pan. pip brings tools for Python. It installs libraries. It helps your code work. It is for the cooking part of AI.

The command nano is a small notebook. Imagine you have a file. You need to fix one line. You open a small notebook. You write the fix. nano opens the file. You type the change. You save it. It is simple. It is quick.

The command line is not scary. It is a quiet desk. It is a place for thinking. It is a place for doing. The cards in the Linux deck are the same commands. They are like trading cards. You can flip them. You can collect them. You can learn them one by one.

If you remember only one thing

The command line is a quiet room where you speak clearly. Respect the master key and the fire that leaves nothing. Keep the cards close so you can find the right tool.

Cards from this chapter