Skip to content

Your First Commands

Now that lash is installed, let’s type some commands. A command is just a word (or a few words) that tells the computer to do something. You type the command, press Enter, and the computer responds with text called output.

Type this and press Enter:

Terminal window
echo "Hello, world!"

You should see:

Hello, world!

The echo command simply repeats back whatever you give it. It is the computer equivalent of a parrot.

Your terminal is always “standing” inside a folder on your computer. To find out which folder you are currently in, type:

Terminal window
pwd

This stands for “print working directory.” A directory is just another word for folder. The output might look something like:

/home/yourname

That is your home folder — the starting point for your files.

To see the files and folders in your current location, type:

Terminal window
ls

This stands for “list.” You will see the names of everything in the current folder, printed out as text.

If you want to see what is inside a text file, use cat:

Terminal window
cat somefile.txt

The contents of the file will be printed directly in the terminal. The name cat is short for “concatenate,” but most people just use it to read files.

Notice the colorful line that appears before your cursor every time lash is ready for a new command. This is the prompt. It shows you which folder you are in, so you always know where you are. When the prompt is showing, lash is waiting for you to type something.

Here is where things get interesting. You can send the output of one command into another command using the pipe symbol (|). Think of it as a real pipe — data flows through it from left to right.

For example, to list your files and then sort them alphabetically:

Terminal window
ls | sort

The ls command produces a list, and sort puts that list in order. You can chain as many commands as you want:

Terminal window
ls | sort | head -5

This lists files, sorts them, and then shows only the first 5 results. head -5 means “give me the first 5 lines.”

Sometimes you want to run two commands one after the other. Use a semicolon (;) to separate them:

Terminal window
echo "Step 1"; echo "Step 2"

Both commands will run in order. The semicolon is like saying “and then.”

Every command finishes with a hidden number called an exit code. If everything went well, the exit code is 0 (zero means success). If something went wrong, it is a number other than zero.

You can check the exit code of the last command you ran:

Terminal window
echo $?

Try it after a successful command, and you will see 0. Now try running something that does not exist:

Terminal window
nonexistent_command
echo $?

You will see a number other than zero, telling you something went wrong. lash’s prompt also shows this visually — the prompt changes color when a command fails.

Sometimes a command takes too long, or you realize you made a mistake. Press Ctrl + C (hold the Control key and press C) to cancel whatever is currently running. This brings you back to the prompt safely.

Try these commands on your own:

Terminal window
echo "My name is awesome"
pwd
ls
echo $?

You just ran four commands, checked your location, listed your files, and verified that everything succeeded. That is a solid start.

Next up: navigating your files and folders like a pro.