This is a quick tutorial to get you using Mac Terminal immediately. In 10 minutes, you'll know the basics.

Step 1: Open Terminal

Press Command + Space to open Spotlight.

Type "Terminal" and press Enter.

You'll see a window with text like:

yourname@MacBook ~ %

This is the command prompt. The ~ means you're in your home folder.

Step 2: See Where You Are

Type this and press Enter:

pwd

Output:

/Users/yourname

pwd stands for "print working directory." It shows your current location.

Step 3: List Files

Type:

ls

You'll see your folders:

Desktop    Documents    Downloads    Pictures    ...

ls lists what's in the current folder.

Step 4: Move to a Folder

Type:

cd Desktop

Now run pwd again:

/Users/yourname/Desktop

You moved to your Desktop folder. cd means "change directory."

Step 5: Go Back

Type:

cd ..

The .. means "parent folder" (one level up). You're back in your home folder.

Step 6: Create a Folder

Type:

mkdir practice

You created a folder called "practice." Check with ls:

ls

You'll see "practice" in the list.

Step 7: Create a File

Enter the folder and create a file:

cd practice
touch hello.txt

touch creates an empty file. Verify:

ls

Output: hello.txt

Step 8: Add Text to the File

Type:

echo "Hello, Terminal!" > hello.txt

This puts text into the file. The > redirects output to a file.

Step 9: View the File

Type:

cat hello.txt

Output:

Hello, Terminal!

cat displays file contents.

Step 10: Clean Up

Delete the file:

rm hello.txt

Go up and delete the folder:

cd ..
rmdir practice

rm removes files. rmdir removes empty directories.

What You Just Learned

Command What it does
pwd Show current directory
ls List files
cd folder Enter a folder
cd .. Go up one level
mkdir name Create folder
touch name Create file
echo "text" > file Write to file
cat file View file
rm file Delete file
rmdir folder Delete empty folder

Practice Suggestions

Try these on your own:

  1. Navigate to your Documents folder
  2. Create a folder called "terminal-practice"
  3. Create three files inside it
  4. View the files with ls
  5. Delete everything when done

Tab Completion

A time-saver: press Tab to autocomplete.

Type:

cd Docu

Press Tab. It completes to:

cd Documents/

Works for commands, files, and folders.

Getting Help

See what a command does:

man ls

Press q to quit the manual.

Or quick help:

ls --help

Next Steps

This tutorial covers the basics. For a complete foundation:

  1. Practice these commands daily
  2. Learn cp (copy) and mv (move)
  3. Learn grep for searching
  4. Take the free course for deeper knowledge

Quick Reference

Keep this handy:

pwd                     # Where am I?
ls                      # What's here?
ls -la                  # Show all details
cd folder               # Go into folder
cd ..                   # Go up
cd ~                    # Go home
mkdir name              # Create folder
touch name              # Create file
cat file                # View file
cp source dest          # Copy
mv source dest          # Move/rename
rm file                 # Delete file
rm -r folder            # Delete folder and contents

Keep Learning

This tutorial got you started. The free course goes deeper with practical lessons.

Check it out at Mac Terminal for Humans.