Beginner’s Guide: Getting Started with the Basics
This tutorial is a practical, command-heavy introduction to core “getting started” skills that transfer across many technical paths: working in a terminal, navigating your computer, managing files, installing software, using Git, and writing your first small scripts. The goal is not to memorize commands, but to understand what they do, why they exist, and how to combine them safely.
1) What you’re learning (and why it matters)
Most beginner guides jump straight into a specific technology. This guide focuses on universal fundamentals:
- Terminal literacy: You can control your system precisely and automate tasks.
- File and directory structure: You understand where things live and how to find them.
- Permissions and safety: You avoid breaking things and learn how to recover.
- Package managers: You install and update tools reliably.
- Git basics: You track changes, collaborate, and roll back mistakes.
- Simple scripting: You automate repetitive work with small programs.
These basics make everything else easier: web development, data science, DevOps, security, and general productivity.
2) Setup: choose your environment
Option A: macOS (recommended for Unix-like basics)
- You already have a Unix-style terminal.
- Open Terminal (Applications → Utilities → Terminal).
Option B: Linux (Ubuntu/Debian examples)
- Open your terminal emulator (e.g., GNOME Terminal, Konsole).
Option C: Windows
You have two good routes:
- WSL (Windows Subsystem for Linux): best for learning Unix commands.
- PowerShell: great, but different commands than Linux/macOS.
This tutorial uses Unix-like commands (Linux/macOS/WSL). If you’re on Windows without WSL, install WSL:
wsl --install
Then open “Ubuntu” from the Start menu.
3) Terminal basics: how commands work
A terminal is a text-based interface where you type commands. Most commands follow a pattern:
command [options] [arguments]
- command: the program you run (e.g.,
ls) - options: modify behavior (e.g.,
-lfor “long format”) - arguments: what to operate on (e.g., a filename)
Your first commands
Check where you are:
pwd
pwdprints the “present working directory” (your current folder).
List files:
ls
List with details:
ls -l
List including hidden files (names starting with .):
ls -la
Understanding output (important)
In ls -l, you’ll see columns like:
- permissions (e.g.,
-rw-r--r--) - owner and group
- size
- modification time
- name
Don’t worry about memorizing—just recognize that commands often have “verbose” modes to show more context.
4) Navigating directories
Change directory:
cd /path/to/folder
Go to your home directory:
cd
Go up one level:
cd ..
Go to the previous directory:
cd -
Paths: absolute vs relative
- Absolute path starts from root
/:/Users/alex/Documents(macOS)/home/alex/Documents(Linux)
- Relative path starts from where you are:
Documents../Downloads
A very common beginner mistake is confusing these. If a command says “No such file or directory,” verify:
- Are you in the directory you think you are? (
pwd) - Does the file exist? (
ls) - Is the path correct (spelling/case)?
5) Creating, moving, copying, deleting (safely)
Create directories
mkdir projects
Create nested directories in one go:
mkdir -p projects/demo/src
-pcreates parent directories if needed and avoids errors if they already exist.
Create files
Create an empty file:
touch notes.txt
Write text into a file (overwrite):
echo "Hello, world" > hello.txt
Append text:
echo "Another line" >> hello.txt
View file content:
cat hello.txt
View with paging (use q to quit):
less hello.txt
Copy files and directories
Copy a file:
cp hello.txt hello-copy.txt
Copy a directory recursively:
cp -r projects projects-backup
Move / rename
Rename a file:
mv hello-copy.txt hello-renamed.txt
Move into a folder:
mv hello-renamed.txt projects/demo/
Delete (be careful)
Delete a file:
rm notes.txt
Delete a directory recursively:
rm -r projects-backup
Safety tip: rm is permanent (no recycle bin by default). Before deleting, you can preview what you’re targeting:
ls -la projects-backup
If you want an interactive prompt before each delete:
rm -ri projects-backup
-iasks for confirmation-rrecursive
6) Searching and inspecting your system
Find files by name
Search under the current directory:
find . -name "hello.txt"
Case-insensitive search:
find . -iname "hello.txt"
Search under your home directory:
find ~ -name "*.txt"
Search inside files (grep)
Search for a word in a file:
grep "Hello" hello.txt
Search recursively in a directory:
grep -R "TODO" projects
Show line numbers:
grep -n "TODO" -R projects
Why this matters: as projects grow, you need to locate definitions, configuration flags, or error messages quickly.
Inspect commands and documentation
Most Unix tools have built-in help:
ls --help
Manual pages (often more detailed):
man ls
Search for a man page keyword:
man -k network
7) Understanding permissions (read/write/execute)
Permissions determine who can read, write, or execute files.
Check permissions:
ls -l
You’ll see something like:
-rw-r--r-- 1 user group 1234 Apr 3 10:00 file.txt
The first chunk -rw-r--r-- means:
- first character: file type (
-file,ddirectory) - next three: owner permissions (
rw-) - next three: group permissions (
r--) - last three: others permissions (
r--)
Making a script executable
Create a script:
echo 'echo "Running a script"' > run.sh
Try running it:
./run.sh
You may get “Permission denied.” Fix it:
chmod +x run.sh
Now run again:
./run.sh
Why “execute” matters
- For files, execute means “run as a program.”
- For directories, execute means “enter/traverse” the directory.
8) Installing software with package managers
Package managers install tools and keep them updated.
Linux (Debian/Ubuntu): apt
Update package lists:
sudo apt update
Install a package:
sudo apt install git curl
Upgrade installed packages:
sudo apt upgrade
macOS: Homebrew
Install Homebrew (from brew.sh). Typically:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install packages:
brew install git curl
Update:
brew update
brew upgrade
What is sudo?
sudo runs a command with administrator privileges. Use it carefully:
- It can modify system files.
- If you don’t understand a command, don’t run it as
sudo.
9) Git fundamentals: track changes and undo mistakes
Git is a version control system. Think of it as:
- a history of your project
- a way to experiment safely
- a collaboration tool
Configure Git once
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Check config:
git config --global --list
Create a new project and initialize Git
mkdir -p projects/first-repo
cd projects/first-repo
git init
Create a file:
echo "# My First Repo" > README.md
Check status:
git status
Stage changes (prepare them for commit):
git add README.md
Commit:
git commit -m "Add README"
View history:
git log --oneline
The mental model: working tree → staging area → commits
- Working tree: your actual files as you edit them
- Staging area: a “draft” of what will go into the next commit
- Commit: a saved snapshot with a message
This model is why Git feels confusing at first, but it’s powerful: you can stage only part of your changes.
Make and commit more changes
echo "Some notes" > notes.txt
git add notes.txt
git commit -m "Add notes file"
Undoing common mistakes
1) You edited a file but want to discard changes
git checkout -- notes.txt
Newer Git also supports:
git restore notes.txt
2) You staged something by accident
git restore --staged notes.txt
3) You want to undo the last commit but keep the changes
git reset --soft HEAD~1
4) You want to undo the last commit and discard changes Be careful:
git reset --hard HEAD~1
Branching: try changes safely
Create and switch to a new branch:
git switch -c experiment
Make a change:
echo "Experiment line" >> README.md
git add README.md
git commit -m "Experiment with README"
Switch back:
git switch main
If your default branch is master, use that instead of main.
Merge the experiment branch:
git merge experiment
Delete the branch (optional):
git branch -d experiment
10) Editing text files (practical options)
You need a way to edit configuration and code.
Option A: nano (beginner-friendly terminal editor)
Open a file:
nano README.md
- Save:
Ctrl + O, then Enter - Exit:
Ctrl + X
Option B: VS Code (popular GUI editor)
If installed, you can open the current folder:
code .
If code is not found, install VS Code and enable the “Shell Command: Install ‘code’ command in PATH” option.
11) Environment variables and your PATH
Environment variables are key-value settings that affect programs.
View a variable:
echo $HOME
Common variables:
HOME: your home folderUSER: your usernamePATH: where the shell looks for executables
View your PATH:
echo $PATH
Why PATH matters
When you run:
git
Your shell searches directories listed in PATH to find the git executable. If a command is “not found,” it may not be installed or not in PATH.
12) Basic networking commands (useful for troubleshooting)
Check if a host is reachable:
ping -c 4 google.com
Fetch a web page:
curl -I https://example.com
Download a file:
curl -L -o example.html https://example.com
Check your IP info (varies by system):
ip a
On macOS, try:
ifconfig
13) Processes: see what’s running and stop it
List processes:
ps aux | less
Find a process by name:
ps aux | grep python
Interactive process viewer (if installed):
top
Or:
htop
Stop a process by PID:
kill 12345
Force stop (last resort):
kill -9 12345
Why this matters: sometimes programs freeze, bind to a port, or consume CPU. Knowing how to inspect and stop them is essential.
14) A gentle introduction to scripting
Scripting means writing a file that runs a sequence of commands.
Bash script example: create a project skeleton
Create a script:
mkdir -p projects/scripts
cd projects/scripts
nano make_project.sh
Paste:
#!/usr/bin/env bash
set -e
if [ -z "$1" ]; then
echo "Usage: $0 <project-name>"
exit 1
fi
NAME="$1"
mkdir -p "$NAME"/{src,tests,docs}
touch "$NAME"/README.md
echo "# $NAME" > "$NAME"/README.md
echo "Created project structure for: $NAME"
Make it executable:
chmod +x make_project.sh
Run it:
./make_project.sh demo-app
Inspect results:
ls -R demo-app
cat demo-app/README.md
Explanation of key lines
#!/usr/bin/env bash: tells the system to run this file with Bash.set -e: exit immediately if a command fails (prevents silent half-finished states).if [ -z "$1" ]; then ...: checks if the first argument is missing.mkdir -p "$NAME"/{src,tests,docs}: brace expansion creates multiple subfolders.- Quotes around variables (
"$NAME") prevent issues with spaces.
15) A tiny Python script (optional but useful)
If Python is installed:
python3 --version
Create a folder:
mkdir -p projects/python-demo
cd projects/python-demo
Create a script:
cat > hello.py << 'EOF'
import sys
name = sys.argv[1] if len(sys.argv) > 1 else "world"
print(f"Hello, {name}!")
EOF
Run it:
python3 hello.py
python3 hello.py Alice
This demonstrates:
- running a program
- passing arguments
- basic input handling
16) Putting it together: a realistic mini-workflow
You’ll create a project, track it with Git, and automate a task.
Step 1: create project and initialize Git
mkdir -p projects/workflow-demo
cd projects/workflow-demo
git init
Step 2: add files
echo "# Workflow Demo" > README.md
mkdir src
echo 'print("hello")' > src/app.py
Step 3: commit
git add .
git commit -m "Initial project structure"
Step 4: make a change and inspect differences
echo 'print("goodbye")' >> src/app.py
git diff
Stage and commit:
git add src/app.py
git commit -m "Add goodbye line"
Step 5: tag a version (common in releases)
git tag v0.1.0
git tag
17) Common beginner errors and how to recover
“Permission denied”
- You may need execute permission (
chmod +x file.sh). - Or you’re writing to a protected directory (avoid
sudounless necessary).
“Command not found”
- The tool isn’t installed (
git,python3, etc.). - Or PATH is missing it. Check with:
which git
which python3
“No such file or directory”
- You’re in the wrong directory (
pwd). - The path is wrong (case matters on most systems).
- The file doesn’t exist (
ls).
You deleted something important
- If it was tracked by Git, you can restore it:
git checkout -- path/to/file
If it wasn’t tracked, recovery is harder. This is why version control and backups matter.
18) Next steps: where to go from here
Once you’re comfortable with the basics above, you can expand in several directions:
- Command line mastery: pipes and redirection in depth (
|,>,>>,2>,xargs) - Shell customization:
.bashrc,.zshrc, aliases, functions - Git collaboration: remotes, GitHub/GitLab, pull requests
- Development environments: virtual environments (Python
venv), Node.js withnpm, containers with Docker - Debugging: reading logs, reproducing issues, minimal test cases
A strong practical goal: pick a small personal project and use terminal + Git for everything. The repetition will make the commands feel natural.
Appendix: Command cheat sheet (with meaning)
| Task | Command | Meaning |
|---|---|---|
| Where am I? | pwd | Print current directory |
| List files | ls -la | List all files (incl hidden) with details |
| Change directory | cd path | Move into a folder |
| Make folder | mkdir -p a/b | Create nested directories |
| Create file | touch file.txt | Make empty file |
| View file | less file.txt | Read with paging |
| Copy | cp src dst | Copy file |
| Move/rename | mv old new | Move or rename |
| Delete | rm -ri folder | Interactive recursive delete |
| Find by name | find . -iname "*.md" | Search files by name |
| Search in files | grep -R "text" . | Search content recursively |
| Help | man cmd | Manual page |
| Install (Ubuntu) | sudo apt install git | Install package |
| Install (macOS) | brew install git | Install package |
| Git status | git status | Show changes |
| Git commit | git commit -m "msg" | Save snapshot |
| Git diff | git diff | Show unstaged differences |
| Branch | git switch -c name | Create and switch branch |
If you want, tell me your OS (Windows/macOS/Linux) and what you’re trying to build (web app, automation, data analysis, etc.), and I can tailor a follow-up “next tutorial” with a focused project and the exact commands to run.