
What you need
- Computer and internet: a laptop or desktop and a stable connection
- System: Windows 10 or 11, macOS or Linux
- Tools: a terminal (on Windows, WSL with Ubuntu)
Download only from each tool's official site and check the address before installing.
What you will learn
You will move around a Linux computer using only the terminal, create and inspect files, read the permissions on every file, and fix the "Permission denied" error that stops so many first deployments.

Most web servers in the world run Linux with no screen at all, only a terminal. Learning this makes the server feel like a familiar room instead of a dark cave.
What you need
- Linux or macOS: open the Terminal app. Every command here works as written.
- Windows: install WSL (Windows Subsystem for Linux), which runs a real Ubuntu Linux inside Windows. Open PowerShell as administrator and run
wsl --install, restart, then open Ubuntu from the Start menu. The first time, Ubuntu asks you to create a Linux username and password. Nothing appears on screen while you type the password; that is normal. Ubuntu has its own home folder, separate from your Windows one, so folders you made in Git Bash do not appear here.
Ask your AI assistant
I am on Windows and want to learn Linux commands. Walk me through installing WSL with Ubuntu step by step, tell me what each step does, and how I know it worked.
Part 1: Where am I?
On Linux, everything lives in one big tree of folders (Linux people say directories), starting at the very top, called the root and written as /.
| Folder | What is usually inside |
|---|---|
/home/yourname |
Your own files. Shortcut: ~ |
/var/www |
Websites, on many servers |
/etc |
System settings |
/tmp |
Temporary files, often cleared when the computer restarts |
Ask the computer where you are:
pwd
pwd means "print working directory". It prints a path such as /home/amina: the folder your terminal is currently in.
Part 2: Moving around
List what is in the current folder:
ls
Now list with details, including hidden files (names starting with a dot, such as .gitignore):
ls -la
-l means "long format" (details), -a means "all" (include hidden files). Options can be combined like this.
Make sure your learning workspace exists (on WSL it is new), then move into it, and back out:
mkdir -p ~/ewoi-learning cd ~/ewoi-learning pwd cd .. cd ~
pwd after the second line prints a path ending in /ewoi-learning, which proves you moved. mkdir -p prints nothing, and does nothing if the folder already exists.
| Command | Meaning |
|---|---|
cd folder |
Go into a folder inside the current one |
cd .. |
Go up one level, to the folder above |
cd ~ or just cd |
Go to your home folder |
cd /var/www |
Go to an exact location, starting from the top |

Press the Tab key while typing a folder name and the terminal finishes it for you. It saves time and prevents typos.
Part 3: Creating, copying and removing
Make a practice folder and a file:
mkdir -p ~/ewoi-learning/notes/linux cd ~/ewoi-learning/notes/linux touch todo.txt echo "Learn permissions" > todo.txt cat todo.txt
| Command | What it does |
|---|---|
mkdir -p path |
Make a folder, including any missing parent folders |
touch file |
Create an empty file (or update the time on an existing one) |
echo "text" > file |
Write text into a file, replacing what was there |
cat file |
Show what is inside a file |
cp a b |
Copy file a to b |
mv a b |
Move or rename a to b |
rm file |
Delete a file |
rm deletes immediately. There is no recycle bin in the terminal. Read the command twice before pressing Enter, and never run a removal command you found online without understanding it.Part 4: Reading permissions
Run:
ls -l todo.txt
You will see a line like this:
-rw-r--r-- 1 amina amina 18 Nov 14 09:12 todo.txt
The first block, -rw-r--r--, is the permissions. Read it piece by piece:
| Piece | Here | Meaning |
|---|---|---|
| 1st character | - |
Type: - is a file, d is a directory |
| Characters 2 to 4 | rw- |
What the owner can do |
| Characters 5 to 7 | r-- |
What the group can do |
| Characters 8 to 10 | r-- |
What everyone else can do |
And the letters:
| Letter | On a file | On a folder |
|---|---|---|
r (read) |
Open and read it | List what is inside |
w (write) |
Change it | Create or delete files inside |
x (execute) |
Run it as a program | Enter it with cd |
- |
That permission is off | That permission is off |
So -rw-r--r-- means: a file the owner can read and change, and everyone else can only read. The next two words, amina amina, are the owner and the group (on a Mac the group is usually staff).
If your line starts with -rw-rw-r-- instead, your system also lets your group write new files. Both are normal: a setting called the umask chooses the starting permissions for new files, and many Ubuntu desktops use this one.

Think of a shared office. The owner has keys to read and edit their files. Colleagues (the group) can read them. Visitors (everyone else) might be allowed to look, or not at all.
Part 5: Permissions as numbers
You will often see permissions written as three digits, such as 644 or 755. Each digit is one group (owner, group, everyone), made by adding:
| Permission | Number |
|---|---|
| read (r) | 4 |
| write (w) | 2 |
| execute (x) | 1 |
So rw- is 4 + 2 = 6, r-x is 4 + 1 = 5, r-- is 4. The common ones:
| Number | Letters | Typical use |
|---|---|---|
644 |
rw-r--r-- |
Normal files: you edit, others read |
755 |
rwxr-xr-x |
Folders and scripts: you do everything, others read and enter or run |
600 |
rw------- |
Private files, such as secrets and SSH keys: only you |
Change permissions with chmod (change mode):
chmod 600 todo.txt ls -l todo.txt
Now the line starts with -rw-------: only you can read it.
Ask your AI assistant
Explain Linux permission numbers like 644, 755 and 600 to a complete beginner. Use a table, then quiz me with three examples and check my answers.
Part 6: Fix "Permission denied"
Create a tiny script, a file containing commands to run:
printf '#!/bin/sh\necho "Hello from my script"\n' > hello.sh cat hello.sh
The first line, #!/bin/sh, tells Linux which program should run the file. Now try to run it:
./hello.sh
./ means "the file in this folder". You get: Permission denied. Read the permissions:
ls -l hello.sh
-rw-r--r-- (or -rw-rw-r--): there is no x, so nobody may execute it. Add execute permission for the owner, then try again:
chmod u+x hello.sh ./hello.sh
u+x means "add execute for the user (owner)". It prints Hello from my script. You just diagnosed and fixed a real permission error by reading the evidence instead of guessing.
The sudo trap
When something says "Permission denied", the internet often says "just add sudo". sudo runs a command as the all-powerful administrator (root). It is sometimes needed, for example to install software:
sudo apt update
But using sudo to silence every permission error is dangerous: files end up owned by root, your app can no longer write to them, and one typo can damage the whole system. First read the permissions, understand who needs what, then fix exactly that.
Why this matters for websites
When you deploy a web app to a Linux server, the web server program runs as its own user (often called www-data). Two classic problems:
| Symptom | Usual cause |
|---|---|
| Blank page or "failed to open stream: Permission denied" in the log | The app cannot write to its storage or cache folder |
| Secrets readable by everyone on the server | The .env file has 644 instead of 600 or 640 |
You now know how to look (ls -l) and how to fix (chmod, and later chown to change the owner).
Recap
pwdshows where you are,ls -lashows what is here,cdmoves you.-rw-r--r--reads as: type, then owner, group, everyone;rread,wwrite,xexecute.- Numbers add up: read 4, write 2, execute 1.
644files,755folders and scripts,600secrets. - "Permission denied" means a missing letter. Read it with
ls -l, fix it withchmod. - Use
sudoonly when you understand why it is needed.
Your practice task
In ~/ewoi-learning/notes/linux:
- Create
secret.txt, write any text in it, and make it readable only by you. Prove it withls -l. - Create a script
today.shthat prints today's date (the command isdate), make it runnable, and run it. - Create a folder
shared, then runls -ld shared(thedshows the folder itself) and write down what each permission means.
Ask your AI assistant
I am learning Linux permissions. Here is my ls -l output for three files and a folder: [paste it]. For each line, ask me what I think the permissions mean, then check my answer. Do not give me the answers first.
Save your work with Git
Finish by keeping this folder's history, the same way as in Your first commit, explained. On WSL, Git is already installed but does not know you yet, so set your identity and default branch once inside Ubuntu (macOS and Linux users did this already):
git config --global user.name "Your Name" git config --global user.email "[email protected]" git config --global init.defaultBranch main
Then, in ~/ewoi-learning/notes/linux:
git init echo "secret.txt" > .gitignore git add .gitignore todo.txt hello.sh today.sh git commit -m "Add Linux practice files" git status
.gitignore keeps secret.txt out of history, the same habit as keeping .env out. Git does not save an empty folder, so shared is not in the commit. git status should end with nothing to commit, working tree clean. Git also records the x on your scripts, so they stay runnable when the project is cloned elsewhere. Your folder now holds:
linux/ ├── .gitignore ├── hello.sh ├── secret.txt (ignored, stays on your computer) ├── shared/ (empty, not saved by Git) ├── today.sh └── todo.txt
Check your understanding

Every lesson stays free. Tap the thumbs up so we know what works, or say thanks with a soda or a coffee: it pays for hosting and new lessons.


