Any and all advice, guides, and reviews are unbiased and based on my personal experience. If you buy through affiliate links, I may earn commissions, which helps support my website. This does not have an impact on posts or my opinion of any reviewed products. If you find this post helpful and want to say thanks, please buy me a coffee or take a look at my book on Amazon. It keeps this page ad-free. Thank you!
A list of useful Raspberry Pi commands.
All of these commands can be executed in the Raspberry Pi command line / shell / terminal or via an SSH connection.
- Initial Pi Setup
- Find your Raspberry Pi Model/Version
- Get Total and Free Memory
- Install Pi Software Updates
- Restart and Reconfigure Options
- Find and Change Pi Hostname
- How to TextEdit with nano
- Pi Power and Heat Management
- Pi EEPROM Updates
- Advanced Pi Commands
Initial Setup
I recommend the official Raspberry Pi OS installer (Windows and macOS versions available) then connect your Pi to a monitor to walk through the setup process. If you want to do a headless install and setup of a Raspberry Pi, then PiBakery is helpful. It’s available for Windows and Mac.
Tips, if you’re cutting and pasting from a Mac to the Pi:
- top copy on the Mac it is ⌘ + C, etc.
- on the Pi you will need to do Control+Shift + C, etc.
Raspberry Pi Model / Version
Find out what model Raspberry Pi you own:
cat /sys/firmware/devicetree/base/model
Raspberry Pi Total and Free Memory
Find out both the free memory and total memory of your Raspberry Pi:
free -h
Software Updates
Check the Software Version
cat /etc/os-release
Check the Raspberry Pi OS Version (32bit or 64bit)
uname -m
Software Updates
Updating System Packages
sudo apt update
then to do a software upgrade of you Raspberry Pi
sudo apt full-upgrade
then remove any un-needed packages for software that is no longer installed
sudo apt autoremove
it’s a good idea to clean up the repository (this won’t look like it does anything, but it does)
sudo apt-get clean
Exit the Shell
exit
Restart and Reconfigure Settings
Restart Raspberry Pi
Not typically necessary on Linux-based systems, but can be useful after updates.
sudo reboot
Raspberry Pi Config Tool
If you need to get into the Pi system configuration tool. You can enable SSH, VNC, rename your Raspberry Pi from here without going into the shell terminal.
sudo raspi-config
Pi Host Names / Changing Pi Hostname
Check Hostname
If you need to check your Pi Host Name, use this command:
hostname
Changing Raspberry Pi Hostname
Edit both
sudo nano /etc/hostname
and
sudo nano /etc/hosts
Text Editing with Nano
Edit A Text File e.g. hosts, etc. using Nano Text Editor
sudo nano [file path]
Useful Log Files (content viewable/editable with Nano)
sudo nano /var/log/messages
sudo nano /var/log/syslog
sudo nano /var/log/dmesg
Raspberry Pi Power & Heat Management
Raspberry Pi Temperature
To get the temperature of your Raspberry Pi, use the terminal command:
/usr/bin/vcgencmd measure_temp
If you have a Raspberry Pi 4, there is a heat management issue in an old firmware version that can only be fixed with an EEPROM update.
EEPROM Update
This ONLY works on the Raspberry Pi 4.
This command will tell you if there’s a new EEPROM version. The last Pi4 EEPROM update was in 2022.
sudo rpi-eeprom-update
Then to install the update, run these commands:
sudo rpi-eeprom-update -a
sudo reboot
Advanced Raspberry Pi Tips
Dynamic DNS
If you’re looking to set up Dynamic DNS on your Raspberry Pi, you can do it natively on the device using NoIP Dynamic DNS. Instructions for NoIP Dynamic DNS on Pi here.
Minecraft Server
Want to run your own Minecraft Server? Best suited to a Pi 3 or 4, learn how to set up a Pi Minecraft Server here.
You will also need to make sure you open a port on your Firewall, the default port for Minecraft is 25565
If you need to check you have set up your Minecraft server so that it is visible from the outside world, try this Minecraft Server Status Tool.
Setup Pi as a Recursive DNS
This is more than just Pi-Hole and establishes your Pi as the DNS server. So it caches requests locally. This gives you more privacy. The Raspberry PI FAQs detail the recursive DNS process and there’s an alternate approach here.
Everything Else
The Pi My Life Up website is a good resource for Pi How To articles.
Any and all advice, guides, and reviews are unbiased and based on my personal experience. If you buy through affiliate links, I may earn commissions, which helps support my website. This does not have an impact on posts or my opinion of any reviewed products. If you find this post helpful and want to say thanks, please buy me a coffee or take a look at my book on Amazon. It keeps this page ad-free. Thank you!