Useful Commands for Raspberry Pi OS
This page is part of a collection of notes that I am making on useful commands for Raspberry Pi OS, formerly know as Raspbian.
Execute the configuration script:
$ sudo raspi-config
Get system information:
$ uname -a
The result should be similar to this:
$ uname -a
Linux raspberrypi 4.9.35+ #1014 Fri Jun 30 14:34:49 BST 2017 armv6l GNU/Linux
The uname command has different options that allow printing specific bits of information, -a prints all information.
Another way to get system information:
$ cat /etc/os-release
The result should be similar to this:
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
You can also use the hostnamectl command:
$ hostnamectl
The result should be similar to this:
$ hostnamectl
Static hostname: raspberrypi
Icon name: computer
Chassis: n/a
Machine ID: 2e7311d7868244978f314762db251c8e
Boot ID: 7d5a2512534d4beabacae8d5fb9400df
Operating System: Raspbian GNU/Linux 8 (jessie)
Kernel: Linux 4.9.35+
Architecture: arm
Get the Raspberry Pi model:
$ cat /proc/device-tree/model
The result should be similar to this:
$ cat /proc/device-tree/model
Raspberry Pi Model B Rev 2
Reboot the system:
$ sudo reboot
Get the process list, CPU, memory usage:
$ htop
Get the system temperature:
$ vcgencmd measure_temp
This command has many other options, please check: https://www.raspberrypi.org/documentation/raspbian/applications/vcgencmd.md
Checking or installing software on Raspebrry Pi OS
Before installing new software it is always good to make sure the system is up to date, for that follow the instructions in page Update Raspberry Pi OS System.
Check if a package is installed:
First check the list of available packages. This uses the package list from the last system update so it might not be up to date.
$ apt-cache search ntfs
Then query if the particular package is installed or not:
$ dpkg-query --status ntfs-3g
Install a package, in this example we’re installing Midnight Commander (mc), a powerful tool for managing files and directories:
$ sudo apt-get install mc
To install git:
$ apt-get install git