Get Human Readable Hardware Details cat /proc/cpuinfo Get RPi Version Code Use the command: cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' The returned code can be looked up on the table at http://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/ , copied below:
Category: Command Line
COM Ports(1)
Command Line Window Tools(1)
File System(4)
IO Pins(2)
Package Managers(1)
Permissions(1)
SSH Tools(1)
wget(1)
Text Files – Viewing
Viewing Text Files head – View the start of a text file Show the first 20 lines: head -20 /home/pi/mytextfile.txt tail – View the end of a text tile Show the last 20 lines tail -20 /home/pi/mytextfile.txt
sudo
Becoming the root user sudo su Which users are allowed to use sudo You can use this command to open the sudoers file: sudo nano /etc/sudoers BE VERY CAREFUL TO COPY THIS FILE BEFORE YOU CHANGE IT – IF YOU MAKE AN ERROR YOU CAN STOP YOURSELF BEING ABLE TO OPEN THE FILE USING SUDO (changes […]
Installing
Fixing broken installs You can use the "–fix-missing" option to retry an install and look for items that we're previously missed due to errors sudo apt-get install somename –fix-missing
Networking
More Networking Things Our Raspbian specific networking stuff is here: https://raspberry-projects.com/pi/category/pi-operating-systems/raspbian/network-settings IP Address ip addr Is A Specific Interface Connected ip link show wlan0 WiFi List discovered networks sudo iwlist wlan0 scan Is network connected ifconfig wlan0 If the inet addr field has an address beside it, the RPi has connected to the network. Get connected […]
Break
On the Raspberry Pi Command Line Break CTRL + Break Via SSH Terminal Programs CTRL + C
tar, for zipping files, directories, etc
Show all options tar –help Create Archive Of Specific Files tar -vfcz outputfilename.gz inputfile1 inputfile2 Zipping Files And Directories Use this to move to the directory containing the files and / or directories you want to zip cd projects/myfolder Zip 1 File tar -vczf zip_output_filename.gz file_to_zip.a Zip 2 Files tar -vczf zip_output_filename.gz file_to_zip1.a file_to_zip2.a Zip A […]
Help
Displaying a programs options Type this on the command line: program_name –help
Sleep
Can be useful when chainging commands together in scripts etc: sleep 5 Will ause a pause of 5 second
Shutdown
This is the best method sudo shutdown -h now This is an alternative (halt and shutdown are not the same thing so a halt command may not cause a complete power off shutdown, it depends on the system): sudo halt