118 lines
2.5 KiB
Markdown
118 lines
2.5 KiB
Markdown
# 🪴 Phase 1: Walking
|
|
|
|
> Goal: Get comfortable with the Linux command line
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 1 — Your First Commands
|
|
|
|
SSH into **alpine-1** (through hop):
|
|
```bash
|
|
# Who am I?
|
|
whoami # → root
|
|
hostname # → localhost (or your hostname)
|
|
uname -a # Show full system info
|
|
uptime # How long since boot
|
|
|
|
# Where am I?
|
|
pwd # Print working directory
|
|
ls -la / # List root directory contents
|
|
|
|
# Make a file
|
|
echo "Hello from Phase 1!" > /root/hello.txt
|
|
ls -l /root/hello.txt # Check file details
|
|
cat /root/hello.txt # Read the file
|
|
```
|
|
|
|
**Repeat on alpine-2 too!**
|
|
|
|
✅ **Verified by Midori**
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 2 — Navigation & File Basics
|
|
|
|
```bash
|
|
# Explore directories
|
|
ls /
|
|
ls /etc
|
|
ls /var
|
|
ls /home
|
|
|
|
# Create a directory structure
|
|
mkdir -p /root/lab/{notes,scripts,logs}
|
|
ls -R /root/lab
|
|
|
|
# Copy and move files
|
|
cp /root/hello.txt /root/lab/notes/
|
|
mv /root/hello.txt /root/lab/backup.txt
|
|
|
|
# Read system files
|
|
cat /etc/hostname
|
|
cat /etc/os-release
|
|
cat /etc/passwd
|
|
|
|
# Answer these:
|
|
echo $SHELL # What shell am I using?
|
|
wc -l /etc/passwd # How many users?
|
|
uname -r # Kernel version
|
|
```
|
|
|
|
### 📝 Questions to answer:
|
|
1. What is your shell?
|
|
2. How many users are listed in `/etc/passwd`?
|
|
3. What kernel version are you running?
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 3 — File Permissions
|
|
|
|
```bash
|
|
# Check permissions
|
|
ls -la /root/lab/notes/
|
|
ls -la /root/lab/
|
|
|
|
# Change permissions
|
|
chmod 644 /root/lab/notes/hello.txt
|
|
chmod 755 /root/lab/scripts
|
|
|
|
# Create a script
|
|
echo '#!/bin/sh' > /root/lab/scripts/sayhello.sh
|
|
echo 'echo "Hello from a script!"' >> /root/lab/scripts/sayhello.sh
|
|
chmod +x /root/lab/scripts/sayhello.sh
|
|
./root/lab/scripts/sayhello.sh
|
|
|
|
# Test permissions
|
|
chmod -x /root/lab/scripts/sayhello.sh
|
|
./root/lab/scripts/sayhello.sh # What happens?
|
|
```
|
|
|
|
### 📝 Questions:
|
|
1. What do the numbers `644`, `755`, and `+x` mean?
|
|
2. What happens when you remove execute permission from a script?
|
|
|
|
---
|
|
|
|
## 🎯 Exercise 4 — Text Editors
|
|
|
|
```bash
|
|
# Try nano (easier)
|
|
nano /root/lab/notes/my-notes.txt
|
|
# Type some text, Ctrl+O to save, Ctrl+X to exit
|
|
|
|
# Try vi (classic)
|
|
vi /root/lab/notes/vi-practice.txt
|
|
# Press 'i' to insert, type something
|
|
# Press Esc, then ':wq' to save and quit
|
|
```
|
|
|
|
---
|
|
|
|
## ✅ Phase 1 Complete Checklist
|
|
- [ ] Exercise 1: `whoami`, `uname -a`, file creation
|
|
- [ ] Exercise 2: Directory structure, `cp`, `mv`, `cat`
|
|
- [ ] Exercise 3: `chmod`, permissions understanding
|
|
- [ ] Exercise 4: Text editors (nano + vi)
|
|
|
|
**Next:** [[Phase 2 - Networking]] 🌐
|