element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog The Swiss Army Knife for the Raspberry Pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: clem57
  • Date Created: 25 Apr 2015 2:42 PM Date Created
  • Views 1105 views
  • Likes 3 likes
  • Comments 5 comments
Related
Recommended
  • terminal
  • rpi2
  • raspbian
  • linux

The Swiss Army Knife for the Raspberry Pi

clem57
clem57
25 Apr 2015

Or Commands for the Terminal

 

Noteimage: there are two “modes” you can work with in Linux. One is a user mode with basic access privileges, and the other is a mode with administrator access privileges (AKA super user, or root). Certain tasks cannot be performed with basic privileges and you will need to enter into root mode to perform them. You will frequently see the prefix sudo before commands, which means that you are telling the computer to operate the command with super user privileges. imageThis will require the root password. Another option is to access the root command prompt, which operates all commands with super user privileges. You can enter root mode by entering sudo su at the command prompt. After entering sudo su, you will see the root@raspberrypi:/home/pi# command prompt, and all subsequent commands can be entered without the sudo prefix and still have super user privileges.image Please do not do this often, because you risk corrupting the software.

 

  • cat /proc/meminfo: Shows details about your memory.

pi@raspberrypi ~ $ cat /proc/meminfo

MemTotal:         883908 kB

MemFree:          483564 kB

MemAvailable:     792000 kB

Buffers:           57944 kB

Cached:           260412 kB

SwapCached:            0 kB

Active:           248736 kB

Inactive:         106836 kB

Active(anon):      37324 kB

Inactive(anon):      688 kB

Active(file):     211412 kB

Inactive(file):   106148 kB

Unevictable:           0 kB

Mlocked:               0 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:               188 kB

Writeback:             0 kB

AnonPages:         37212 kB

Mapped:            31812 kB

Shmem:               800 kB

Slab:              31180 kB

SReclaimable:      21596 kB

SUnreclaim:         9584 kB

KernelStack:        1520 kB

PageTables:         1512 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:      441952 kB

Committed_AS:     298988 kB

VmallocTotal:    1171456 kB

VmallocUsed:        1824 kB

VmallocChunk:     949592 kB

 

 

  • cat /proc/partitions: Shows the size and number of partitions on your SD card or hard drive.

pi@raspberrypi ~ $ cat /proc/partitions

major minor  #blocks  name

   7        0     986256 loop0

179        0   31636480 mmcblk0

179        1      64512 mmcblk0p1

179        2   31570944 mmcblk0p2

 

  • cat /proc/version: Shows you which version of the Raspberry Pi you are using.

pi@raspberrypi ~ $ cat /proc/version

Linux version 3.18.6-v7i-aufs (max@lynx) (gcc version 4.8.4 (Buildroot 2015.02-git-g537b3c0-dirty) ) #1 SMP PREEMPT Tue Feb 10 22:35:34 CET 2015

 

  • df -h: Shows information about the available disk space.

pi@raspberrypi ~ $ df -h

df: `/squashfs': No such file or directory

Filesystem      Size  Used Avail Use% Mounted on

rootfs           30G  6.4G   22G  23% /

dev             423M     0  423M   0% /dev

/dev/mmcblk0p2   30G  6.4G   22G  23% /mnt

none             30G  6.4G   22G  23% /

tmpfs            87M  256K   87M   1% /run

tmpfs           5.0M     0  5.0M   0% /run/lock

tmpfs           173M     0  173M   0% /run/shm

/dev/mmcblk0p1   63M   36M   28M  57% /media/12D6-E54E

 

  • dpkg --get-selections | grep XXX: Shows all of the installed packages that are related to XXX.

pi@raspberrypi ~ $ dpkg --get-selections | grep python

idle-python2.7                    install

idle-python3.2                    install

libpython2.7                    install

python                        install

python-dbus                    install

python-dbus-dev                    install

python-gi                    install

python-minecraftpi                install

python-minimal                    install

python-numpy                    install

python-picamera                    install

python-pifacecommon                install

python-pifacedigitalio                install

python-pygame                    install

python-rpi.gpio                    install

python-serial                    install

python-support                    install

python-tk                    install

python2.7                    install

python2.7-minimal                install

python3                        install

python3-minimal                    install

python3-numpy                    install

python3-picamera                install

python3-pifacecommon                install

python3-pifacedigital-scratch-handler        install

python3-pifacedigitalio                install

python3-pygame                    install

python3-rpi.gpio                install

python3-serial                    install

python3-tk                    install

python3.2                    install

python3.2-minimal                install

 

  • dpkg –get-selections: Shows all of your installed packages (image Could be a very very long list).

  • free -m: Shows how much free memory is available.

pi@raspberrypi ~ $ free -m

             total       used       free     shared    buffers     cached

Mem:           863        390        472          0         56        254

-/+ buffers/cache:         79        783

Swap:            0          0          0

 

  • lsusb: Lists USB hardware connected to your Raspberry Pi.

pi@raspberrypi ~ $ lsusb

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.

Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB

Bus 001 Device 006: ID 0bda:2832 Realtek Semiconductor Corp. RTL2832U DVB-T

Bus 001 Device 007: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB

  • UP key: Pressing the UP key will enter the last command entered into the command prompt. This is a quick way to correct commands that were made in error.

  • vcgencmd measure_temp: Shows the temperature of the CPU.

pi@raspberrypi ~ $ vcgencmd measure_temp

temp=38.5'C

 

  • vcgencmd get_mem arm && vcgencmd get_mem gpu: Shows the memory split between the CPU and GPU.

pi@raspberrypi ~ $ vcgencmd get_mem arm && vcgencmd get_mem gpu

arm=880M

gpu=128M

 

Enjoy Terminal,image

Clem

  • Sign in to reply

Top Comments

  • Former Member
    Former Member over 10 years ago +1
    Hi Clem, Thank you for this list. Very useful! Best, Ommo
  • mcb1
    mcb1 over 10 years ago

    NIce list Clem.

    It is intimidating for newbies so this should be an excellent resource for them.

     

    Thanks

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 10 years ago

    Your welcome. BTW, anyone have more commands they like/use, send me a note and I will add to this list.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago

    Hi Clem,

     

    Thank you for this list. Very useful!

     

    Best,

    Ommo

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 10 years ago in reply to DAB

    Until people get familiar, I figure this a good list of things to know.

    Cheers,

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago

    Hi Clem,

     

    Thanks for providing this information.

    I know I always find Linux intimidating since I never had any real training on how to use.

     

    You did a good job showing what the commands can provide when you enter the write sequence.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube