The Terminal
The terminal (also called the command line or shell) lets you control your computer by typing commands. Developers use it every day to run projects, install packages and use Git.
Why Use the Terminal?
Many developer tools have no buttons; they only work from the terminal. Examples are npm, git, python, php, dotnet and deployment tools. Once you know 10 basic commands, the terminal is often faster than clicking.
Opening a Terminal
| System | Terminal |
|---|---|
| Windows | PowerShell, Windows Terminal, or Git Bash (installed with Git) |
| macOS | Terminal (search with Cmd+Space) |
| Linux | Terminal (Ctrl+Alt+T on Ubuntu) |
| Any | The terminal inside VS Code: Ctrl+Backtick |
The commands below work in Git Bash, macOS, Linux and mostly in PowerShell too.
Where Am I?
The terminal always works inside one folder, the current directory.
Example
pwd
ls/home/ayesha/projects bakery-site notes.txt portfolio
pwdprints the current folder (print working directory)lslists the files and folders in it (ls -laalso shows hidden files)
Moving Around
Example
cd bakery-site
pwd
cd ..
cd ~/home/ayesha/projects/bakery-site
| Command | Goes to |
|---|---|
cd folder | A folder inside the current one |
cd .. | One level up |
cd ~ | Your home folder |
cd / | The top of the drive |
cd - | The previous folder |
Press Tab to complete folder and file names. Type cd bak and press Tab, and the terminal finishes bakery-site for you. It saves time and avoids typing mistakes.
Files and Folders
Example
mkdir new-site
cd new-site
touch index.html style.css
lsindex.html style.css
| Command | What it does |
|---|---|
mkdir name | Make a folder |
touch file | Create an empty file (Git Bash, macOS, Linux) |
cp a.txt b.txt | Copy a file |
cp -r folder copy | Copy a folder |
mv old.txt new.txt | Rename or move |
rm file | Delete a file |
rm -r folder | Delete a folder and everything inside |
cat file | Show what is inside a file |
code . | Open the current folder in VS Code |
rm deletes files permanently. They do not go to the Recycle Bin. Double-check before pressing Enter.
Useful Shortcuts
| Key | Action |
|---|---|
| Up / Down arrows | Repeat previous commands |
| Tab | Complete a name |
| Ctrl+C | Stop the running program (like a dev server) |
Ctrl+L or clear | Clear the screen |
| Ctrl+R | Search your command history |
Running Programs
Most tools you install add a command to the terminal. Check versions to confirm they work:
Example
node --version
git --version
python --versionv22.11.0 git version 2.47.0 Python 3.12.7
If you see "command not found" or "is not recognized", the tool is not installed, or the terminal needs to be restarted after the installation.
Flags and Help
Many commands accept flags that change how they work, like -la in ls -la. To learn a command's options, use:
Example
git --help
ls --helpExercise
Exercise
Which command moves you one folder up?
