Raspberry Pi Tips and Tricks

Raspberry Pi OS Basic commands

In this post I am listing out some raspberry pi tips and tricks. These frequently used commands will help you maintain and use your raspberry pi efficiently and should help you in resolving some basic issues.

Keeping your Operating System up to Date

APT keeps a list of software sources on your Pi in a file at /etc/apt/sources.list. Before installing software, you should update your package list with apt update.

sudo apt update

Next, upgrade all your installed packages to their latest versions with the following command:

sudo apt full-upgrade  [use full-upgrade instead of upgrade as it also picks dependencies]

Clean unused downloaded packages

sudo apt clean 


sudo apt-get clean 

Installing a Package with APT

sudo apt install <package name>

Uninstalling a Package with APT

sudo apt remove <package name>


sudo apt purge tree [purge will remove the package and its associated configuration files]

Update your Raspberry Pi OS kernel and VideoCore firmware

sudo rpi-update [make sure to take a backup before using rpi-update]
sudo reboot

Note: if you have done an rpi-update and its not working as you expected, and if your Raspberry Pi is still bootable you can return to the stable release using following command.

sudo apt-get update
sudo apt install --reinstall libraspberrypi0 libraspberrypi-{bin,dev,doc} raspberrypi-bootloader raspberrypi-kernel

If you are not able to boot then restore from backup.


Useful Utilities

There are several useful command line


tvservice is a command line application used to get and set information about the display, targeted mainly at HDMI video and audio.

  • tvservice -s displays the current HDMI status, including mode and resolution
  • tvservice -m CEA lists all supported CEA modes
  • tvservice -m DMT lists all supported DMT modes


The vcgencmd tool is used to output information from the VideoCore GPU on the Raspberry Pi.

Vcos – The vcos command has two useful sub-commands:

  • version displays the build date and version of the firmware on the VideoCore.
  • log status  displays the build date and version of the VideoCore firmware.

get_camera – Displays the enabled and detected state of the Raspberry Pi camera: 1 means yes, 0 means no

measure_temp – Returns the temperature of the SoC as measured by the on-board temperature sensor.

get_lcd_info – Displays the resolution and colour depth of any attached display.



vcdbg is an application to help with debugging the VideoCore GPU from Linux running on the the ARM. It needs to be run as root. This application is mostly of use to Raspberry Pi engineers, although there are some commands that general users may find useful.

sudo vcdbg help will give a list of available commands.


GPIO and the 40-pin Header


A powerful feature of the Raspberry Pi is the row of GPIO (general-purpose input/output) pins along the top edge of the board. A 40-pin GPIO header is found on all current Raspberry Pi boards

rapberry pi 2 pinout 2

Raspberry Pi  pinout figure 1

You can also use the command pinout in your terminal window to get raspberry pi pin details.

Raspberry Pi provides the raspi-gpio package which is a tool for hacking and debugging GPIO

You need to run raspi-gpio as root. To install raspi-gpio:

sudo apt install raspi-gpio

The raspi-config Tool

sudo raspi-config


For more details refer the official documentation on raspberry pi.



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.