General Raspberry Pi Commands

Add A New User

sudo adduser alice

You will be prompted to create a password.

The new user home directory is at /home/alice/

Add to the sudo group and give sudo permissions:

sudo adduser alice sudo

sudo su: If it runs aok account is in sudo group.

Add user to groups via: Sudo adduser alice adm

Add to the following groups: adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

Disable wifi & bluetooth

Sudo apt install rfkill:  Sudo rfkill list all

Sudo rfkill block Bluetooth:  Sudo rfkill block wifi

OR Edit config file

Sudo nano /boot/config.txt

# Disable Bluetooth:  Dtoverlay=pi3-disable-bluetooth

#Disable Wi Fi:  Dtoverlay=pi3-disable-wifi

Add Video Codecs

From a command prompt type:

sudo nano /boot/config.txt  –

Add the line: decode_MPG2=XXXXXXX

Where XXXXXX is the code you got when you bought the MPG2 licence from the Raspberry Pi store.

Then CTRL O to save the file then CTRL X to exit.

Check if enabled from the command prompt by typing:

vcgencmd codec_enabled MPG2

vcgencmd codec_enabled WVC1

To shred a file:

Open a command prompt in the directory the file (called test.doc) you want to shred is located.

Type:

shred –u test.doc

The -u can be replaced with the following:

-f: Changes permissions to allow writing if needed

-n=x: Overwrites x times instead of the default (*3)

-s=x: Specifies the number of bytes, x, to shred

-u: Truncates and removes files after overwriting

-v: Shows verbose information about the progress

-x: Do not round file sizes up to the next full block

-z: Adds a final overwrite with zeros to hide shredding

-u: Removes the file after overwriting

Linux Encryption

To create an encrypted usb stick connect to the internet and type the following from a command prompt:

sudo apt install cryptsetup

sudo apt install gparted

To view cryptsetup encryption data type

cryptsetup –help

To encrypt a file with gpg

To encrypt a file called test.doc, open the command prompt in the directory it is located in and type:

gpg –c test.doc

You will then be asked to enter the password you want to use. Twice.

To decrypt the file stay in the directory and type:

gpg test.doc.gpg

Enter your password and you should see the document appear in the folder.

How To Install Kodi

With a Raspberry Pi you can listen to music, watch tv and videos and generally use it as a home entertainment system.

You should be able to do most things with VLC (which comes installed with Raspbian OS). However you can also use other free software such as OSMC, Volumio or Kodi.

I thought I would try Kodi as it is available as an install from the Raspberry Pi repository. Learning to do everthing (and in the right order) involved a fair amount of searching online, but I managed to distil the process down to the following:

I used the following hardware:

Raspberry Pi 3B+ / 16 GB micro SD card / Keyboard / Mouse / Monitor /

Download Raspbian Lite and check the SHA-256 checksum is right. Put the .img file on a micro sd card using software called imager. (Available from the Raspberry Pi website)

Put the card in the RPi 3B+ and connect to a screen a keyboard and mouse and switch it on. It will go through its set-up procedure which should only take a minute or two.

Change the default password and connect to the Pi to the internet. At the command prompt type:

sudo apt update

sudo apt install ufw

sudo ufw enable

Restart the RPi. At the command prompt type:

sudo apt update

sudo apt upgrade

Then type: Y

This should install all the software updates.
Restart the RPi. Then at the command prompt, install the desktop via:

Sudo apt install raspberrypi-ui-mods
Sudo reboot

Open a terminal window and type the following:

Sudo apt install kodi
Reboot

Open a terminal window and type:

Sudo raspi-config

Change the memory split so that the GPU has 256 megabytes
Change the boot options so that the RPi boots to cmd
Open a terminal window and type the following:

crontab –e

Choose the nano option

Add: @reboot kodi –standalone

Crtl O then Crtl X to save and close the file.

You might also like to stop the firewall if not going back on line again by going to a command prompt and type:

sudo ufw disable

Reboot and hey presto Kodi should start up and be available to you.

There is a way to install the RPi Lite OS without the raspberrypi-ui-mods and then install

Kodi and add the dependancies that the Kodi gui needs. It looks a bit complex from what I have read online so I just chose to do it this way.

It seems relatively simple and it works for me. I will try at some point to do it without the Raspberry Pi gui which should free up some more resources.

Install Raspberry Pi OS

There are several operating systems that can be installed on the Raspberry PI. The following details how to install the Raspberry Pi Foundations own OS, Raspberry Pi OS.

OR. You can download Raspberry Pi Imager from the Raspberry Pi website and do it all automatically. But where is the fun in that.

There are 3 versions available:

1: Raspberry Pi OS with desktop and recommended software

2: Raspberry Pi OS with desktop

3: Raspberry Pi OS Lite

This is how to install No: 1 (Though it holds pretty much true for the other 2 versions)

Download the OS from the official Raspberry Pi website and make a note of the integrity hash. Unzip the downloaded file to a directory. (I usually leave it in the Downloads directory)

You can check the integrity hash by running a checksum utility against the downloaded file to see if the sha256 sum is the same as that from the website. I use a Linux machine to do the following:

In a terminal go to the directory location that you have saved the downloaded file too. For example the Downloads directory.

Run the following command from the command prompt within the Downloads directory

sha256sum OSMC_TGT_rbp2_20190424.img

The result will appear a few seconds later. If the resulting alpha/numerical sequence matches the one from the Raspberry Pi website the file should be safe to use.

To install the .img file to a micro sd card open a terminal at the directory containing the image file.

Type at command line:

sudo dd bs=1M if=OSMC_TGT_rbp2_20190424.img of=/dev/sda

(To view the progress of an operation, add to the end: status=progress)

Once that has completed after a couple of minutes, put the micro sd card in the Raspberry Pi and connect up to a monitor, power supply and keyboard. Switch on and let it go through the setup process.

The first thing to do is change the default password on the Raspberry Pi. Go to

Make a note of the new password as you will need it when you run some of the following commands.

You can now connect the Raspberry Pi to the internet via wireless or cat5 cable.

Open a command prompt by

and type:

sudo apt update

sudo apt install ufw

sudo ufw enable

Restart the Pi.

This will install a basic firewall for when you go online.

You can check it is enabled by typing from the command prompt:

sudo ufw status

At the command prompt type:

sudo apt update

sudo apt upgrade

Then type: Y

This should install all the software updates available.

You should now have a fully installed and updated Pi.

It is usually wise at this point to make a full back up of your working install. There is software on the Pi that lets you do this. Simply go to

You can play around with the various settings to change the look of your system i.e. change the background, font size, location of the taskbar etc.