Setup and admin commands, GPIO/I2C/SPI concepts with a Python example, and a headless-setup walkthrough.
| Category | Command | Description |
|---|---|---|
| Config | sudo raspi-config | Opens the interactive configuration tool — interfaces, boot options, locale, hostname. |
| Config | sudo raspi-config nonint do_ssh 0 | Enables SSH non-interactively — the standard trick for headless setup scripting. |
| System Info | vcgencmd measure_temp | Reads the SoC temperature — the standard thermal-throttling check. |
| System Info | vcgencmd get_throttled | Returns a bitmask flagging under-voltage or throttling events since boot. |
| System Info | cat /proc/cpuinfo | Shows CPU details, including the board's Revision code (identifies exact Pi model). |
| Storage | df -h | Shows disk usage — the standard "is the SD card full" check. |
| Storage | sudo raspi-config --expand-rootfs | Expands the root filesystem to fill the whole SD card — usually automatic on first boot. |
| Network | hostname -I | Shows the Pi's current IP address(es) — the fastest way to find it for SSH. |
| Network | sudo nmtui | Text-mode Wi-Fi/network configuration UI (current Raspberry Pi OS / NetworkManager-based). |
| Camera | libcamera-still -o photo.jpg | Captures a still photo from the official camera module (current libcamera stack). |
| Camera | libcamera-vid -o video.h264 -t 10000 | Records 10 seconds of video from the camera module. |
| Packages | sudo apt update && sudo apt full-upgrade | Updates package lists and upgrades installed packages, including ones needing removals (kernel updates). |
| Power | sudo shutdown -h now | Safely powers off — always shut down cleanly before pulling power, to avoid SD card corruption. |
| Power | sudo reboot | Restarts the Pi. |
| Services | systemctl status servicename | Checks the status of a systemd service — same as any modern Linux distro. |
| Firmware | sudo rpi-update | Updates the bootloader/firmware — for troubleshooting only, not part of routine updates. |
GPIO Concepts
BCM vs. Board Numbering
BCM numbers refer to the Broadcom SoC's internal GPIO numbering; Board numbers are simple physical pin-position counting (1-40) — libraries let you pick either mode, and mixing them up is the most common wiring bug.
3.3V Logic
GPIO pins are 3.3V, not 5V-tolerant — feeding a GPIO input 5V directly can permanently damage it. Use a level shifter or voltage divider for 5V sensors.
I2C
A 2-wire (SDA/SCL) bus for sensors/displays that each have an address — enable via raspi-config, then scan the bus to confirm a device is detected.
SPI
A faster 4-wire bus (MOSI/MISO/SCLK/CE) used for displays and ADCs — also enabled via raspi-config's interface options.
UART (Serial)
The hardware serial port on GPIO 14/15 — by default it may be used for Bluetooth or the Linux console, so enabling a project's own use of it sometimes needs the console disabled first.
PWM
Only specific GPIO pins support true hardware PWM — check the pinout before wiring a servo or dimmable LED to an arbitrary pin.
Enabling Interfaces
| Command | Purpose |
|---|---|
sudo raspi-config nonint do_i2c 0 | Enables I2C non-interactively. |
sudo raspi-config nonint do_spi 0 | Enables SPI non-interactively. |
sudo raspi-config nonint do_camera 0 | Enables the camera interface non-interactively. |
i2cdetect -y 1 | Scans I2C bus 1 and prints the address of any connected device. |
Flash the OS with Raspberry Pi Imager
The official imager's advanced options (gear icon / Ctrl+Shift+X) let you pre-set the hostname, enable SSH, and configure Wi-Fi credentials before the first boot — no separate boot-partition file editing needed on current versions.
Boot and wait for network join
First boot takes longer than usual (filesystem expansion, key generation) — give it a couple of minutes before trying to connect.
Find it on the network
ping raspberrypi.local (mDNS, works on most networks) or check your router's DHCP client list if a custom hostname was set.
SSH in and change the default password
ssh username@raspberrypi.local, then run passwd immediately — current Raspberry Pi OS no longer ships a universal default password, but any credential set during imaging should still be treated as first-boot-only.
Quick Tips
vcgencmd get_throttled returning a non-zero value) means the power supply/cable can't keep up — always use the official (or equivalently rated) power supply, especially with USB peripherals attached.dd/Win32DiskImager) can create a full backup image of a working setup — cheap insurance before a risky config change.