Module 4 cheat sheet: Linux & Web Servers
Move around Linux, manage files safely, and publish a website on EC2 with Apache or IIS.
Navigation
| Command | Does |
|---|
| whoami / pwd | who and where am I |
| cd /path · cd .. · cd - · cd ~ | move around |
| ls -a · ll | list, incl. hidden / long |
| sudo -i · exit | become root · go back |
| history · clear | past commands · clear screen |
Day 11 →
Files and folders
| Command | Does |
|---|
| mkdir -p a/b | create folders |
| touch f | empty file |
| cat f · cat > f · cat >> f | view · overwrite · append |
| cp -r · mv | copy · move/rename |
| rmdir · rm -rf | delete empty · delete all (careful!) |
Editors
| vi | nano |
|---|
| Start typing | i | just type |
| Save & quit | Esc → :wq | Ctrl+X → Y → Enter |
| Quit, no save | Esc → :q! | Ctrl+X → N |
Directory tree
| Path | Meaning |
|---|
| / | root directory (top) |
| /root | root user’s home |
| ~ | current user’s home |
| /var/www/html | Apache website |
| /var/log | logs |
Code: Apache on Ubuntu
sudo -i
apt update -y && apt install apache2 -y
systemctl enable --now apache2
echo "<h1>Hello from EC2</h1>" > /var/www/html/index.html
Common mistakes
- Port 80 not open in the security group.
- Skipping
apt update before installing. - Saving index.html.txt on Windows.
- Running
rm -rf without checking pwd.
Day 12 →
Created by Ajeetkumar · EasyLearnSpace