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

TaskCommand
Show current directorypwd
List filesls -lah
Change directorycd path
Create directorymkdir -p name
Copy / movecp, mv
Delete carefullyrm -r
View filecat, less, head, tail
Search textgrep, rg
Show running processesps aux, top, htop
Check portsss -tulpn
Follow logsjournalctl -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:

PackageWhy install it
gitversion control and pulling projects
curltesting HTTP endpoints and downloads
tmuxpersistent terminal sessions
htopinteractive process viewer
rsyncreliable file sync
python3-venvisolated 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

ApproachBetter choice when
DHCP reservation on routerYou control the network and want central management
Static configuration on PiThe 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:

  1. SSH into the Pi.
  2. Install a package.
  3. Create a project directory.
  4. Start a simple Python HTTP server.
  5. Check which port it listens on.
  6. Stop it.
  7. 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.