MALIKA KAROUM

MALIKA KAROUM

  • Home
  • Inleiding
  • Unite Arab Emirates
  • Blog
  • video’s
  • Promotion
    • Worth for free now
    • Work from Home 2023
    • Gadgets
    • All about Windows
    • about Whatsapp
    • Whats the
    • About websites
    • New Ways
    • New Way of Watching
    • Virtual
    • Website
    • All about Video
    • How to Use
    • YouTube Info
    • All about Twitter
    • The Best of
    • About Apps
    • Google News
    • For Free
    • About This
    • Need More
    • Why should you
    • Iphone news
    • Interesting News
    • About Amazone
    • Some tips
    • About Netflix
    • All about Music
    • About Facebook
  • Marketing
    • Malika Karoum Strategie Modules
    • Malika Karoum Online Marketing
    • Malika Karoum Business Service
    • Malika Karoum Marketing Platform
    • Online business marketing
  • Luxury
    • The Indulgence Business site
    • The Luxury Web site
    • The Ultimate Indulgence
    • The Indulgence Site
    • The Ultimate Luxury Information site
    • Online luxury
  • Malika Karoum
    • Malika Karoum LinkedIn
    • Malika Karoum Facebook
    • Malika Karoum Instagram
    • Malika Karoum Business News
    • Adverteren grote fraude
    • Menu POS
    • Malika Karoum Evenementen
  • Security
  • Malika Karoum link
  • Home
  • Malika Karoum Global News
  • The Ultimate Raspberry Pi Commands Cheat Sheet
March 25, 2023

The Ultimate Raspberry Pi Commands Cheat Sheet

The Ultimate Raspberry Pi Commands Cheat Sheet

by Malika Karoum / Sunday, 02 August 2020 / Published in Malika Karoum Global News
raspberry-pi-accessories

The Raspberry Pi is the most popular single-board computer (SBC) available. Just $ 35 gets you a powerful, fully-fledged Linux computer with Wi-Fi, Bluetooth, and 40 connected general-purpose input/output (GPIO) pins. It’s no surprise that the Raspberry Pi is equally popular between professional engineers, computer hobbyists, makers, and in the education sector.

While the Raspberry Pi runs on Linux, there are a few more features that you’d find in a common Linux distribution. The addition of GPIO pins, along with the two main libraries supporting them, means much more to remember!

That’s why we’ve prepared this handy cheat sheet for day-to-day Raspberry Pi usage.

FREE DOWNLOAD: This cheat sheet is available as a downloadable PDF from our distribution partner, TradePub. You will have to complete a short form to access it for the first time only. Download The Ultimate Raspberry Pi Commands Cheat Sheet.

The Ultimate Raspberry Pi Commands Cheat Sheet

Command Result
Raspbian OS Terminal
cat [name] Show the contents of the file [name]
cd .. Change to parent directory
cd [path] Move to the directory at [path]
cd / Change to root directory
cd ~ Change to your home directory – usually “/home/“
chmod [who][+,-,=][permissions] [name] Change the permissions for a file
chmod 777 [name] Allow all users to read, write and execute the file [name]
chmod u+x [name] Allow the user to execute [name]
cp -r [from] [to] Copy all files and subdirectories from source [from] to destination [to]
cp [from] [to] Copy a file from source [from] to destination [to]
find Search for files and their contents
grep ‘string’ [name] Search inside one or more files for occurrences of ‘string’
head [name] Return all occurrences of ‘string’ within file [name]
ls List the contents of the current directory
ls -a List all files including hidden files
ls -l List the contents of the current directory with more file information
ls [path] List the contents of the directory found at [path]
man [command] Open the manual/help page for [command]
man man Open the manual/help page for the ‘man’ command (helpception)
mkdir [name] Create a directory called [name] in the current working directory
mv -r [from] [to] Move all files and directories from source [from] to destination [to]
mv [from] [to] Move a file from source [from] to destination [to]
pwd Show the name of the current working directory
python/python3 –version Shows you what version of Python you currently have installed
rm -r * Remove all files and directories from the current working directory
rm [name] Remove the specified file
rm * Remove all files from the current working directory
rmdir [name] Remove the empty directory [name] from the current working directory
sudo [command] Superuser do. Execute [command] with elevated privileges (Allows you to do things you usually wouldn’t have access to)
sudo apt-get ​install [package] Install a package
sudo apt-get update Update the list of packages
sudo apt-get upgrade Upgrade the installed packages – must be run after sudo apt-get update
sudo ​chown pi:root [name] Change the owner of the file [name] to user ‘pi’ and set the group to ‘root’
​sudo raspi-config Launch the Raspberry Pi configuration menu
sudo reboot Safely restart your Pi
sudo shutdown -h now Safely shutdown your Pi immediately
sudo su Places you in the root directory with root user access – be careful with this!
tail [name] Show the end of file [name]
tar -cvzf [name] [path] Create compressed file [name] from the contents of [path]
tar -xvzf [name] Extract the contents of the compressed file [name]
wget [uri] Download the file found at [uri] on the internet
RPi.GPIO Library
import RPi.GPIO as GPIO Import the RPi.GPIO module into the python sketch
GPIO.setmode(GPIO.BCM) Use Broadcom pin numbers (GPIO 14, GPIO 15 etc)
GPIO.setmode(GPIO.BOARD) Use board pin numbers (4,5, 8 etc)
GPIO.getmode() Returns current pin numbering mode (BCM, BOARD, or None)
GPIO.setup([pin number], GPIO.IN) Set up the pin at [pin number] to be an input
GPIO.setup([pin number], GPIO.IN, pull_up_down=GPIO.PUD_DOWN) Set up the pin at [pin number] to be an input with internal pull down resistance
GPIO.setup([pin number], GPIO.IN, pull_up_down=GPIO.PUD_UP) Set up the pin at [pin number] to be an input with internal pull up resistance
GPIO.setup([pin number], GPIO.OUT) Set up the pin at [pin number] to be an output
GPIO.setup([pin number], GPIO.OUT, initial=1) Set up the pin at [pin number] to be an output with the initial value ‘1’
GPIO.output([pin number], 1) Set [pin number]’s value to 1. Note that 1, GPIO.HIGH and True are the same thing
GPIO.output([pin number], 0) Set [pin number]’s value to 0. Note that 0, GPIO.LOW and False are the same thing
i = GPIO.input([pin number]) Set the variable i to the value of [pin number]
if GPIO.input([pin number]): Use the value of [pin number] as a boolean in code
GPIO.cleanup() Reset all GPIO pins (good practice to call before leaving any program)
GPIO.VERSION Returns current RPi.GPIO version
GPIO Zero Library
LEDs
from gpiozero import LED Import the LED section of the gpiozero library
led = LED(17) Assign the ‘led’ variable to an LED on pin GPIO 17
led.on() Turn on the LED stored in the ‘led’ variable
led.off() Turn off the LED stored in the ‘led’ variable
led.toggle() Toggle the LED stored in the ‘led’ variable (if it’s off, turn it on and vice versa)
Motors
from gpiozero import Motor Import the Motor section of the gpiozero library
motor = Motor(17, 18) Assign the variable ‘motor’ to a Motor object containing the forward and backward drive pin numbers
motor.forward() Activate the forward pin of the variable ‘motor’
motor.backward() Activate the backward pin of the variable ‘motor’
motor.reverse() Reverse the current motor direction
motor.stop() Stop the motor
Buzzer
from gpiozero import Buzzer Import the Buzzer section of the gpiozero library
bz = Buzzer(3) Assign the variable bz to a Buzzer on pin GPIO3
bz.on() Turn the buzzer on
bz.off() Turn the buzzer off
bz.toggle() Toggle the buzzer’s state (if it’s off, turn it on and vice versa)
Servo
from gpiozero import Servo Import the Servo section of the gpiozero library
servo = Servo(17) Assign the ‘servo’ variable to a Servo on GPIO 17
servo.min() Move the servo to its minimum value
servo.mid() Move the servo to its middle value
servo.max() Move the servo to its maximum value
servo.value = 0.5 Move the servo to a set numerical point (min = -1, max = 1)
Raspi Camera Image
raspistill Command to take a still image with attached camera, modify with arguments below
–width, -w Set image width
–height, -h Set image height
–quality, -q Set JPEG quality <0 to 100> (75 is most common)
–raw, -r Inserts raw Bayer data from the camera into the JPEG metadata
–output, -o Output filename (required for saving)
–latest, -l Add latest frame to filename
–verbose, -v Verbose debugging information during run
–timeout, -t Set a time to wait before capturing an image.
–encoding, -e Encoding to use for output file – jpg, gif, bmp, or png
Raspi Camera Video
raspivid Command to take a video using attached camera, modify with arguments below
–width, -w Set image width (between 64px – 1920px)
–height, -h Set image height (between 64px – 1080px)
–bitrate, -b Set bitrate in bits per second (i.e 15 Mbits/s = 15000000)
–output, -o Output filename (required for saving)
–verbose, -v Verbose debugging information during run
–timeout, -t Set a time to wait before capturing video
–framerate, -fps Specify the frames per second for recording

Expand Your Knowledge With Linux

These commands will help you navigate the Pi’s terminal, and program its GPIO pins. That said, this cheat sheet doesn’t even begin to scratch the surface. There is a huge depth of support for hobby components, cameras and screens for the Raspberry Pi. Listing them in one place is almost impossible!

The good thing is, since the Raspberry Pi is a Linux computer, you can reference a cheat sheet for general Linux systems to expand your knowledge even further.

Read the full article: The Ultimate Raspberry Pi Commands Cheat Sheet

MakeUseOf

  • Tweet
Tagged under: Cheat, Commands, Raspberry, Sheet, Ultimate

About Malika Karoum

What you can read next

Thanksgiving Is Saved! Zoom Lifts Time Restriction on Turkey Day
How to Remove Android Viruses Without a Factory Reset
How to Use Your Phone as a Spotify Remote

Malika Karoum Blog 2023

  • How to Delete the Last 15 Minutes of Your Google Search History

    There’s a quick way for you to clear your...
  • Lenovo Wants You to Know Its Yoga Pad Pro Can Be Used as a Portable Switch Display

    Sometimes, when playing with your Nintendo Swit...
  • The 5 Best Apps for Buying and Selling Pre-Owned Books

    We’ve all been at the point where we have...
  • Humble’s Recent "Heal Covid-19" Bundle Raised 1.2 Million for Charity

    To help raise money for COVID-19 relief in Indi...
  • Nintendo Partners With PlayVS to Make Its Games Recognized High School Varsity Athletics

    It’s odd—Nintendo gets a lot of flak for ...
  • The Pros and Cons of Playing Video Games on an Emulator

    If you’re a fan of playing retro video ga...
  • 5 Curators to Find the Best Articles Worth Reading on the Internet

    When anyone and everyone is a publisher, it isn...
  • Apple Could Unveil iPads With OLED Screens in 2023

    Apple only just switched from LCD to mini-LED d...
  • What Is Signal and How Does It Work?

    The chances are that you use at least one of th...
  • Samsung’s Upcoming Flagship Exynos Chipset Will Feature AMD’s RDNA2 GPU

    AMD confirmed its partnership with Samsung at C...
  • Atari Finally Reveals the Launch Date for the New Atari VCS Console

    At last, after what seems like an age (it pract...
  • Twitter Starts Testing Full-Screen Ads in Fleets

    Twitter has announced that it will be adding fu...
  • When Is Facebook Messenger Going to Offer End-to-End Encryption?

    Facebook Messenger is easy to use and has great...
  • Get Paid to Play Apps: How They Work and What You Risk

    You’ve probably seen advertisements for a...
  • When Will PS5 Production Ensure Supply Meets Demand?

    Despite the PS5’s launch taking place in ...
  • How to Manage Processes on Ubuntu Using System Monitor

    Linux, like most modern operating systems, is v...
  • How to Get Verified on Twitter and Finally Get That Blue Check Mark

    Twitter, like most social media platforms, offe...
  • 10 Street Photography Tips That Will Make You a Better Photographer

    Street photography is enjoyed by many enthusias...
  • Huawei Freebuds 4i Review: Quality ANC Earbuds for $100

    Huawei Freebuds 4i 8.00 / 10 Read Reviews Read ...
  • What Is Extended Reality (XR) and How Does It Work?

    We’re living in a digital age where the virtual...

MALIKA KAROUM ONLINE MARKETING PLATFORM

Office:
RME HOLDINGS SARL – DUBAI BRANCH

BUSINESS CENTER

Parcel ID: 345-835

Area: Bur Dubai

Sub Area: Burj Khalifa

UNITED ARAB EMIRATES

 

 

 

Malika Karoum Concept

Malika Karoum Projects

  • GET SOCIAL

© 2014 Malika Karoum -United Arab Emirate Dubai- All Rights Reserved

TOP