Linux CLI, Files, Packages, and Networking
Why This Matters
Raspberry Pi becomes dramatically more useful when you stop treating it like an appliance and start treating it like a small Linux host you control confidently.
Commands You Should Know Cold
| Task | Command |
|---|---|
| Show current directory | pwd |
| List files | ls -lah |
| Change directory | cd path |
| Create directory | mkdir -p name |
| Copy / move | cp, mv |
| Delete carefully | rm -r |
| View file | cat, less, head, tail |
| Search text | grep, rg |
| Show running processes | ps aux, top, htop |
| Check ports | ss -tulpn |
| Follow logs | journalctl -u service -f |
Package Management Basics
Most Raspberry Pi OS installations use apt.
sudo apt update
sudo apt install -y git curl vim tmux htop rsync
A few packages that make life easier:
| Package | Why install it |
|---|---|
git | version control and pulling projects |
curl | testing HTTP endpoints and downloads |
tmux | persistent terminal sessions |
htop | interactive process viewer |
rsync | reliable file sync |
python3-venv | isolated Python environments |
Filesystem Habits That Age Well
Suggested Layout for Personal Projects
/home/your-user/
├── projects/
│ ├── garden-monitor/
│ ├── signage-display/
│ └── camera-node/
├── data/
│ ├── garden-monitor/
│ └── camera-node/
├── backups/
└── logs/
Keep code separate from mutable data. That one habit prevents a lot of deployment pain.
Logs and Services
Many important services log through systemd.
systemctl status ssh
journalctl -u ssh --since today
journalctl -xe
When your app becomes a service later, this is where you'll debug it.
Networking Skills That Matter Most
See Current Addresses
hostname -I
ip addr
Test Connectivity
ping -c 4 1.1.1.1
ping -c 4 github.com
Check Open Ports
ss -tulpn
Static IP vs DHCP Reservation
| Approach | Better choice when |
|---|---|
| DHCP reservation on router | You control the network and want central management |
| Static configuration on Pi | The network is fixed and you need predictable behavior even without router control |
For home labs, router reservation is usually simpler and safer.
A Few Bash Patterns Worth Learning
Find Large Files
du -sh * | sort -h
Tail Multiple Logs During Debugging
journalctl -u my-app -u nginx -f
Search for Config References
grep -R "camera-node" /etc/systemd /etc/nginx /home/your-user/projects
Backups of Config Matter More Than Reinstalls
If your Pi dies, you mostly care about:
- project source code
- environment configuration
- service definitions
- database dumps or sensor history
- secrets and tokens stored safely
A fresh image is easy. Reconstructing months of config drift is not.
Mini Exercise: Build Operational Confidence
Practice these until they feel normal:
- SSH into the Pi.
- Install a package.
- Create a project directory.
- Start a simple Python HTTP server.
- Check which port it listens on.
- Stop it.
- Inspect logs and system resources.
Example:
mkdir -p ~/projects/test-app
cd ~/projects/test-app
python3 -m http.server 8000
In another terminal:
curl http://pi-lab.local:8000
ss -tulpn | grep 8000
Next Step
Move to 04-python-and-hardware-control.md to start writing software that actually does useful work on the Pi.