Raspberry Pi Command Reference

I have vague recollections of using the Command Line Interface while at university playing with Apollo Domain workstations. That was 1988.
I loathe Linux runes. They're still with us. They're not going to go away.

Raspberry Pi 3 Model B

Capacitor

Logging in

pi
raspberry

Update the OS

sudo apt-get update
sudo apt-get dist-upgrade
sudo raspi-config

Shutting down nicely

sudo shutdown -h now
or
sudo reboot

Killing tasks

top - Using "top" you can sort by cpu or memory usage. hit "F" to change the output. Select a task ID and then kill it!
sudo kill 2050

pigpio

Pronounced Pig Pie Oh!
The pigpio library controls the General Purpose Input Outputs (GPIO)
This tutorial explains how to control RGB LED-Strips using pigpio

rm pigpio.zip
sudo rm -rf PIGPIO
sudo wget abyz.co.uk/rpi/pigpio/pigpio.zip
sudo unzip pigpio.zip
cd PIGPIO
sudo make -j4
sudo make install
sudo pigpiod
hostname -I (That's minus big i)

Lights

Capacitor

Let's start our Lights code <Under Development> when the Pi boots up.

Use crontab and edit with...
sudo crontab -e
note the last line...
@reboot python /home/pi/Desktop/lights1.py

The basic commands

pwd
chmod 777 myfile
ls
cd <folder>
cd ..
mkdir
free -o -h
clear

Pi specific commands

cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/version
cat /proc/partitions
vcgencmd measure_temp
vcgencmd get_mem arm && vcgencmd get_mem gpu
lsusb
startx - starts the GUI

Samba

Map a folder to the Pi

sudo apt-get install samba samba-common-bin
Edit the Samba configuration file using:
sudo nano /etc/samba/smb.conf

Scroll down until you find the [Homes] section and change read only = yes to read only = no

Add

[pihome]
  comment= Pi Home
  path=/home/pi
  browseable=Yes
  writeable=Yes
  only guest=no
  create mask=0777
  directory mask=0777
  public=no

Then...

sudo service smbd restart
sudo service samba reload
sudo systemctl restart smbd

Test with:

testparm
sudo pdbedit -L
sudo pdbedit -a pi
sudo smbpasswd –a pi (No! doesn't work anymore - it did yesterday! Try above.)

then using Windows connect to...
\\raspberrypi\pi

RDP

Remote Desktop

sudo apt-get install xrdp

Change the Pi's name

sudo nano /etc/hosts
edit the last line. Then edit ...
sudo nano /etc/hostname
then...
sudo reboot

Install Mono AKA C#

sudo apt-get install mono-complete

Create a working folder...

mkdir HelloWorld
cd HelloWorld

Then create/edit HelloWorld.cs with the following:

using System;

public class HelloWorld
{
    public static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}

then compile and run
gmcs HelloWorld.cs
sudo mono HelloWorld.exe

Command Line Charp

sudo csharp

then try something like...

Environment.OSVersion;

Converting Raspberry Pi Camera .h264 to .mp4

sudo apt-get install gpac
MP4Box -add filename.h264 filename.mp4

Logout, but keep running an application

^Z
bg
then close putty...

Page last edited 21st July 2016. nick@anotherurl.com



The Raspberry Pi Foundation provides low-cost, high-performance computers that people use to learn, solve problems and have fun.

Raspberry Pi Foundation