ABSTRACT

The Terminal (also called Command Line or Shell) is a text-based way to talk to your computer. Instead of clicking icons, you type instructions. It’s faster, customisable and more powerful.

1. Opening the Terminal

Before you can time, you need to open the terminal:

  • macOS: Press Cmd + Space, type “Terminal” and hit Enter.
  • Linux/WSL: Press Ctrl + Alt + T.

2. Navigation

Think of the terminal as a “File Explorer” (Explorer/Finder) without the windows. You are always inside a folder.

  • pwd (print working directory): Shows the path to the folder you are currently standing in.
  • ls(list): Shows the list of files and folders inside you current location.
  • cd <folder>(change directory): Moves into a folder.

3. Managing Files & Folders

  • mkdir <name>(make directory): creates a new folder.
  • touch <filename>: create a new, empty file.
  • rm <filename>(remove): Deletes a file.
  • rmdir <folder>: Deletes an empty folder.
  • rm -rf <folder: Forces delete of a non-empty folder.

Remove Commands

Running a remove command (rm, rmdiror rm -rf), fully deletes a file or directory. It is not moved to a trash bin, once run it is completely gone. Be very careful!

4. Reading and Editing

You don’t need to open Notepad or TextEdit to see what’s inside a file.

  • cat <filename>: Dumps the entire text of a file into your terminal so you can read it.
  • nano <filename>: Opens a simple, “old-school” text editor inside the terminal.
    • Press Ctrl+O and Enter to save, and Ctrl + Xto exit.

These text editors are very basic and, especially for beginners, you may consider using a dedicated text editor application (like Visual Studio Code or PyCharm). These are applications that allow you to manage files and edit them more intuitively. They also have a built in terminal (i.e., you can open the terminal from the application itself).

5. Understanding the System

Unix organises files like a tree. Everything starts at the Root (/).

  • /: The very top level (there is no mother directory).
  • ~: Short-hand for your Home folder (where your personal files live, normally the user folder in the computer)
  • sudo (SuperUser Do): Use this before a command if you get a “Permission Denied” error. It’s communicates you are the administrator and it will prompt you to enter your password.

6. Beginner Tips

  • Tab Completion: Start typing a folder name and hit theTabkey: the terminal finishes the word for you.
  • clear: Use this when the screen gets to messy.
  • man <command>: If you forget how a command works, type man followed by the command (e.g., man ls, man rm) to see the manual. Press qto quit the manual.

SUCCESS

Now that you can move files around, let’s learn how to track changes to your code with 13_git.