Raspberry Pi Command Line

Linux Command Line

Over the course of our Raspberry Pi experiments, my son and I have come across some very useful Linux command-line commands that we wanted to remember. Our scribbled notes seemed like a primitive method of record-keeping so we decided to add this quick reference page to the website. Many of these commands require Super-User (root account or system administrator) privileges and will have sudo in front of them. Also, many will have several more possible parameters than are listed and following the command with -help will list them.

In case you don’t know, the Raspberry Pi’s Linux Command Line is available when you boot up your Pi or when you open a terminal window from within the Raspbian Desktop Environment. It looks like this:

pi@raspberrypi ~ $

Useful Linux Commands:

  • sudo apt-get dist-upgrade — Intelligently upgrade changes in the distribution’s dependency system
  • sudo apt-get rpi-update — Update the Raspberry Pi’s Kernel
  • sudo apt-get update — Update the package list
  • sudo apt-get upgrade — Upgrade the packages to the newest versions
  • cat file_name.txt — Display the contents of the specified file
  • cat /proc/meminfo — Shows information about the Raspberry Pi’s memory
  • cat /proc/partitions — Shows the size and number of partitions on the SD card
  • cat /proc/version — Show the current Kernel version
  • cd directory_name — Change the current directory
  • clear — Clear the terminal screen
  • cp ~/file_name.txt /directory_name — copy a file in the current directory to a specified directory
  • date — Show the current day, date, and time
  • df -h — Shows information about available disk space
  • df / — Show free disk space
  • find / -name file_name.txt — Search the system for the requested file and show all directories containing the filename
  • free — Shows current memory usage
  • hostname -I — Shows the IP address of the Raspberry Pi
  • ifconfig — Display the status of the wireless connection
  • iwconfig — Display the currently used wireless network
  • ls — List the files in the current directory
  • ls -l — List files in the current directory with file size and permissions
  • lsusb — List USB hardware connected
  • mkdir directory_name — Create a new directory within the current directory
  • mv ~/file_name.txt /directory_name — Move file to new directory
  • nano file_name.txt — Open the specified file in the Linux text editor
  • ping ip_address — ping a specified ip address
  • sudo poweroff — Shutdown immediately
  • sudo raspi-config — Open the Raspbian configuration program
  • reboot — Reboot the system
  • sudo rm file_name.txt — Remove the specified file
  • sudo rm -rf directory_name — Recursively remove all files from within a directory and then delete the directory
  • sudo rmdir directory_name — Delete the empty directory specified
  • service –status-all — Show a list of all running daemons
  • sudo shutdown -h now — Shutdown the Raspberry Pi
  • sudo shutdown -h 10:25 — Shutdown the Raspberry Pi at 10:25 AM
  • startx — Start the Raspberry Pi’s Desktop Environment
  • su – — Log in as the Super User
  • touch file_name.txt — Create an empty file in the current directory
  • vcgencmd measure_temp — Show the Raspberry Pi’s CPU temperature
  • vcgencmd get_mem arm && vcgencmd get_mem gpu — Show the memory split between the CPU and GPU
  • wget http://www.website_name.com/file_name.txt — Download a specified file from the Internet to the current directory

Leave a Reply