This guide will share common commands I run on Raspberry PI’s during setup.
You can read my other posts on Useful Linux Terminal Commands and Useful OSX Terminal Commands.
Read CPU Temp
Method 1:
$/opt/vc/bin/vcgencmd measure_temp
$ temp=31.5’C
Method 2: (and divide result by 1000)
$ cat /sys/class/thermal/thermal_zone0/temp $ 4
31545
Raspberry Pi Configuration
$ sudo raspi-config
Show Raspberry Pi Networking Information
$ ifconfig
Take Raspberry Pi Still Image
$ sudo raspistill -hf -vf -a “Sample Text” -o /temp/image.jpgor with date
or with date
$ DATE=$(date +”%Y-%m-%d_%H%M”);
$ sudo raspistill -hf -vf -a “Sample Text” -o /temp/image-%DATE.jpg
take photo with smaller preview window
$ sudo raspistill -hf -vf -a “Sample Text” -p 100,100,400,250 -o /temp/image.jpgor with date
Set Keyboard to US
$ sudo nano /etc/default/keyboard
Change “gb” to “us”
Upload image via scp
$ sudo scp /temp/image.jpg [email protected] /www/image.jpg
$ < password
TIP: If you need to send a passwords via scp automatically then try this.
Install sshpass (to pass passwords to scp)
sudo apt-get install -y sshpass
Make RAM Disk
This is useful to write to in scripts so the SD card does not wear out.
In a bash script type
#!/bin/bash
sudo mkdir -p /ramdisk
sudo mount -t tmpfs -o size=50m tmpfs /ramdisk
Create a ramdisk on startup
run crontab -e and add
add
@reboot sudo bash /scripts/makeramdisk.sh
Kill active process
Alt + PrintScr + k
Tip: Use crontab to start scripts not /etc/rc.local, as my keyboard locked up when I called a python script from rc.local?
Copy and paste code block on nano text editor
Go to the start of the text block to copy and press CTRL+6, now highlight the text to copy
Press ALT+6 to copy
Goto where you want to paste the text and press Ctrl+U
I hope this helps someone, I will update the post as I find new commands.
Donate and make this blog better
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]
Revision History
v0.5 Ramdisk v0.4 Copy text blocks in nano
V0.3 kill active process
v0.2 working draft (ssh pass)