Skip to content

Terminal & Command Line for Beginners

DodaTech Updated 2026-06-22 6 min read

In this tutorial, you'll learn about Terminal & Command Line for Beginners. We cover key concepts, practical examples, and best practices.

Learn terminal basics: navigate folders with cd, list files with ls, create directories with mkdir, and run Python scripts from the command line.

What You'll Learn

By the end of this tutorial, you will navigate your file system using the terminal, create and delete files and folders, and run Python programs from the command line.

Why It Matters

The terminal gives you direct control over your computer. Many developer tools — Git, package managers, compilers — are used exclusively through the terminal. Avoiding it limits what you can do as a programmer.

Real-World Use

When developers at DodaTech deploy updates to DodaZIP or analyze logs from Durga Antivirus Pro, they use the terminal. It is faster and more powerful than graphical tools for many tasks.

Your Learning Path

flowchart LR
  A[Dev Environment Setup] --> B[Terminal Basics]
  B --> C[First Website]
  C --> D[Choose a Language]
  D --> E[Build Projects]
  B --> F{You Are Here}
  style F fill:#f90,color:#fff
â„šī¸ Info

Prerequisites: A working development environment from the previous tutorial. Python should be installed.

What Is the Terminal?

The terminal (also called command line or shell) is a text-based way to interact with your computer. Instead of clicking icons and menus, you type commands.

Think of it like this:

  • Graphical interface: You walk to the fridge, open the door, and take out the milk
  • Terminal: You type "get milk from fridge" and the milk appears

The terminal is faster once you learn the commands.

Opening the Terminal

OS How to Open
Windows Search for "Command Prompt" or "PowerShell" in the Start menu
macOS Press Cmd + Space, type "Terminal", press Enter
Linux Press Ctrl + Alt + T, or search for "Terminal"

Your First Commands

When the terminal opens, you see a prompt. It might look like:

user@computer:~$

or

C:\Users\YourName>

The prompt shows your username, computer name, and current directory. The ~ or C:\Users\YourName means you are in your home directory.

Check Your Current Location

pwd

Expected output:

/home/yourname

or on Windows:

C:\Users\YourName

pwd stands for "print working directory" — it shows where you are right now.

List Files and Folders

ls

Expected output (your files will differ):

Desktop  Documents  Downloads  Music  Pictures  Projects

ls lists everything in your current directory. On Windows, use dir instead.

cd Projects

cd stands for "change directory." This moves you into the Projects folder. Check with pwd to confirm.

Go Back

cd ..

Two dots mean "parent directory." This takes you up one level.

Essential File Operations

Create a Folder

mkdir my-new-project

mkdir stands for "make directory." This creates a new folder called my-new-project.

Create an Empty File

On macOS/Linux:

touch hello.py

On Windows:

type nul > hello.py

touch creates an empty file (or updates the timestamp if the file already exists).

Delete a File

rm hello.py

Warning: The terminal does not use the trash bin. Deleted files are gone permanently.

Delete a Folder

rm -r my-new-project

The -r flag means "recursive," which deletes the folder and everything inside it.

Running Python From the Terminal

Create a Python file:

# save as greet.py
name = input("Enter your name: ")
print("Hello, " + name + "!")

Run it from the terminal:

python greet.py

Expected behavior:

Enter your name: Alice
Hello, Alice!

You just wrote and ran a Python program from the command line.

Useful Shortcuts for the Terminal

Shortcut Action
Up arrow Show the last command you typed
Down arrow Show the next command
Tab Auto-complete file and folder names
Ctrl + C Cancel the current command
Ctrl + L Clear the terminal screen
Ctrl + A Go to the beginning of the line
Ctrl + E Go to the end of the line

The tab key is especially useful. Type cd Proj and press Tab. If Projects is the only folder starting with "Pro," the terminal fills in the rest automatically.

Understanding Paths

Symbol Meaning
. Current directory
.. Parent directory
~ Home directory
/ Root directory (macOS/Linux)
/ or \ Separator between folder names

You can use absolute paths (starting from the root) or relative paths (starting from your current location):

# Absolute path
cd /home/yourname/Projects

# Relative path (if you are already in /home/yourname)
cd Projects

Common Mistakes Beginners Make

1. Not Using Tab Completion

Typing full file paths is slow and error-prone. Always use Tab to auto-complete. It saves time and prevents typos.

2. Deleting Files Without Checking

rm filename deletes permanently. There is no undo. Use ls first to verify the file exists and you want to remove it.

3. Running Commands From the Wrong Directory

If python greet.py says "No such file," check your current directory with pwd. The file must be in the same directory you are in.

4. Confusing / and \

macOS and Linux use forward slashes (/) in paths. Windows uses backslashes (\). When typing paths in Python code, use forward slashes on all systems.

5. Not Reading Error Messages

The terminal shows error messages that tell you exactly what went wrong. A "command not found" error means the command does not exist or is not installed. "Permission denied" means you need admin access.

6. Forgetting Spaces in Paths

If a folder name has a space (like My Projects), you must quote it or escape the space:

cd "My Projects"
# or
cd My\ Projects

7. Running Dangerous Commands Without Understanding

Some commands can damage your system. rm -rf / deletes everything on macOS/Linux. Never run a command you do not understand. Search online first.

Practice Questions

1. What does cd .. do? Moves you up one level to the parent directory.

2. What is the difference between rm file.txt and rm -r folder? rm file.txt deletes a single file. rm -r folder deletes a folder and everything inside it recursively.

3. Why is Tab completion useful? It auto-completes file and folder names, saving time and preventing typos.

4. What does pwd show? It prints the full path of your current working directory.

5. Challenge: Using only the terminal, create a folder called practice, navigate into it, create a file called hello.py, write a print statement into it using echo 'print("Hello")' > hello.py, and run it. You have just completed the same workflow developers use for quick scripts.

Try It Yourself

Open your terminal and navigate to your Projects folder. Create a folder called terminal-practice. Inside it, create a Python file that asks for a favorite color and responds with a compliment. Run it from the terminal.

color = input("What is your favorite color? ")
print(color + " is a great choice! That color is used in Doda Browser's theme.")

Run it with:

python terminal-practice/color.py

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro