top of page

Using the Terminal

The following instructions are for Mac computers. If you have a Windows computer, use this Windows tutorial.

​

The Terminal app lets you type in commands to instruct the computer. You can create and organize files, run programs, and more. Like your Finder app, the Terminal allows you to navigate within the folders of your file system. Instead of clicking on a folder to see its contents, you type "ls". You can also change to a different folder by entering "cd folder-name", and you can determine the current folder by typing in "pwd".

​

In this tutorial, you'll try out the terminal and its commands to navigate within the file system. This capability is vital for many purposes, including running tools and apps needed as you develop software with tools like Cursor.

​

1: Add Your Home Folder to Finder Favorites

Before you begin using the terminal, make sure your home folder is in the Finder favorites:​

  • Open Finder.

  • In the top menu, click Go > Home (or press Shift + Command + H to go there directly).

  • Once in your home folder, drag the home folder icon from the Finder window sidebar into the Favorites section on the left.

  • Now, you can quickly access your home folder from Finder anytime.

 

2: Open a Terminal

​

  • Open Spotlight Search by pressing Command + Space.

  • Type Terminal and press Enter to open it.

  • You should now see a window with a command prompt, ready for input.

 

3. Use Terminal to Explore the Filesystem

In this section, you'll use basic terminal commands (pwd, ls, and cd) to navigate through the filesystem and compare it with what you're accustomed to in the Finder app.
 

pwd: the current folder within terminal
  • In the terminal, type "pwd" (the "%" below signifies the terminal prompt, do not type it. Your prompt will be different).

    % pwd
     

  • The terminal will list the current directory-- your location in the file system. At this point, it should be your home folder, e.g., /Users/wolberd/
     

2. List Files (ls)
  • Next, type "ls":

    % ls
     

  • The terminal will list all the files and folders in your current directory.
     

  • Compare the output in Terminal with what you see in Finder. If your home folder is selected in your finder, it will show the same file.
     

3. Change Directories (cd)
  • Navigate into the Documents folder using the "cd" command:

    % cd Documents
     

  • Confirm you are in the correct location by typing "pwd":
     

       % pwd
 

    The terminal should show you the full path to the "Documents" folder. 
 

  • You can go back to the home directory by typing "cd .." to go to the folder "above" or "cd ~"​ to go home no matter where you are.

 

4. Experiment and Compare

Now that you know the basics, try the following:
 

  • Use cd to navigate to different folders and compare locations in Finder.

  • Use "ls -l" to see a more detailed list of files.

  • Open Finder and create a new folder, then show it by going to the enclosing folder and typing "ls".
     

This practice will help you understand how the Terminal and Finder represent the same filesystem but in different ways.

​

5. Self-Test
Test yourself: if you've created a (Cursor) app, use "cd" to navigate to that folder, then "ls" to list the files in that folder. Then navigate back back to your home folder. Note: if any of your folder names have spaces, use Finder to rename them and eliminate the spaces (or any punctuation). Folder and file names with spaces make things more difficult in the Terminal, so its best to avoid.

 

Essential Commands
  1. pwd – Print Working Directory (where you are)

  2. ls – List files in the directory

    • ls -l (detailed list with permissions, size, etc.)

    • ls -a (shows hidden files)

  3. cd – Change directory

    • cd .. (move up one level)

    • cd /absolute/path/ (navigate to absolute path)

    • cd ~/ (home directory shortcut)

  4. mkdir – Make a new directory

  5. rmdir – Remove empty directory

  6. rm -r – Remove directory and contents (use with caution)

  7. cp – Copy files and directories

    • cp file1 file2 (copy file1 to file2)

    • cp -r dir1 dir2 (copy directories recursively)

  8. mv – Move (rename) files and directories

    • mv file1 newname (rename file)

    • mv file1 /new/path/ (move file)

  9. touch – Create an empty file (useful for practice)

  10. cat – View the contents of a file

  11. less – View a file page-by-page (q to quit)

  12. echo – Print text or output a message

    • echo "Hello World"

    • echo "export PATH=$PATH:/my/custom/path" >> ~/.bashrc (modify environment variables)

  13. clear – Clear terminal screen

  14. exit – Close the terminal session
     

Helpful Extras

1. man – Show manual pages for commands (man ls)

2. which – Find the location of an executable (which python)

3. whoami – Show current user

4. chmod – Change file permissions (chmod +x script.sh)

5. ./ – Run an executable file in the current directory (./myprogram)

6. nano or vim – Open a simple text editor (nano file.txt)

7. Knowing how to Navigate the terminal

​

Learn More

video tutorial

© 2025 PeopleCode.AI.

bottom of page