codehaven - php snippets - coding help
Generic filters
Exact matches only
  • Basic Raspberry Pi Commands

    26th October 2014


    Raspberrypi - Codehaven

    When setting up for first time, make sure you expand the filesystem. It will cause errors otherwise.

    sudo raspi-config

    Linux commands

    password: pi
    username: raspberry
    show gui: startx

    Find current directory


    Go back a directory

    cd ..

    List contents of directory

    ls -l

    Create Directory

    sudo mkdir /home/myscreen


    wget -qO- | tar xvz -C /myscreen

    Delete directory (Careful!)

    sudo rm -rf myfolder

    Show attached devices


    edit config file

    sudo raspi-config

    show temp of chip

    vcgencmd measure_temp

    show cpuinfo

    cat /proc/cpuinfo

    touch mynotes.txt

    creates an empty text file

    show sixes of partitions

    cat /proc/partitions

    show version number

    cat /proc/version

    open file

    sudo nano (ctrl o to save, ctrl x to exit)

    get root

    sudo bash


    sudo halt


    sudo reboot

    show ipaddress


    install firefox/chromium

    sudo apt-get install iceweasel
    sudo apt-get install chromium-browser –yes

    uninstall a program

    apt-get purge

    Show what packages you have installed

    dpkg -l

    Show last packages installed
    grep install /var/log/dpkg.log

    delete file

    rm index.html

    see all running processes(q=quit)

    mv /home/jack/testfile /home/jack/testfile2

    Set permissions for all files in a folder

    When you are in the folder you want to talk about: –
    sudo chmod 777 *


    Play a wav file: aplay siren.wav

    Record a sound: arecord -D plughw:1 –duration=5 -f cd -vv ~/rectest.wav
    Play an mp3 or wav: omxplayer –vol 3000 rectest.wav

    apt-get install phpmyadmin
    To stop/start/restart Apache 2 web server : sudo /etc/init.d/apache2 stop
    anything in the /etc/bash.bashrc is run when a shell starts up

    To close a program

    > find the pid number of program eg chromium then use :

    Show history of installs

    less /var/log/apt/history.log

    Add PHP MYSQL & APACHE in one line

    This is the best, short tutorial on setting this up easily.

    Install PHPmyadmin

    Easy tutorial to install phpmyadmin

    Install FTP

    The most simplistic way to install FTP

    Second Simplist way to install ftp

    Backup your SD card with OS

    How to Clone Your Raspberry Pi SD Card for Super Easy Reinstallations

    Testing the Sound

    Play an mp3 using the headphone jack and headphones

    Remote desktop into Raspberry pi

    Remote tutorial

    Record Sound using Raspberry Pi

    Record using microphone

    Install Apache

    Easy way to install Apache

    Getting your Pi to Speak

    More options: –
    –voices Show all the voices
    -vXX Use voice XX, e.g. “-vaf” is “use the af voice”.
    -vXX+YY Use variant YY, e.g. “-vaf+f2” is “use the af voice with the female variant 2”. The variants are:
    None (male voice)
    +m1, +m2, +m3, +m4, +m5 (male variants)
    +f (female voice)
    +f1, +f2, +f3, +f4, +f5 (female variants)
    +whisper (male whisper)

    Send emails from the Raspberry Pi

    Just use this

    once this is installed….

    You can remotely connect to database by just using the ip address in a php script, instead of localhost

    Was this code snippet helpful?