The Raspbian desktop interface is very popular, but the command line interface (LXTerminal) is useful as well. Following are some common commands. Note: Linux (on which Raspbian is built), is case sensitive. Additionally, most linux commands offer help to show command usage and the available parameters. Type the command followed by – -help .
Lists the contents of the current storage directory (your micro SD or a disk drive if connected) . Optionally, a directory can be specified as in ls /home/pi . Adding the -l (lower case L) parameter will display information about the files and directories.
Changes to the directory specified after the command. Examples: cd /home/pi , cd python_games . Use of the / specifies an absolute path starting at the root (top) directory. Use of cd without a / uses the current directory as its starting point.
Copy a file from one location to another. Example: cp /home/pi/blink-led.py /home/pi/Programming-Examples/blink-led.py .
Moves a file from one location to another. Can also be used to rename a file by “moving from one name to another”. Example: mv rgb-led.py Programming-Examples/rgb-led.py .
Removes a file, or files. Example: rm rgb-led.py . Use the * as a “wildcard” to remove mutiple files: rm rgb*.* .
Makes a directory. mkdir mynewdirectory .
Shows the amount of storage space used. Use the -h parameter to show space in kilo-, mega- or gigabytes. Example: df -h .
Displays system information. Use the -a parameter to display all information including release level. uname -a .
Lists the attached USB devices.
Shows Linux Standard Base information. Use the -a option to show all including release and codename. lsb_release -a .
Retrieve a web page “web get”. wget http://www.website.com/filename will retrieve “filename” and put into the current directory.
Substitutes user for commands. Most often used to invoke the “super user” authority for a command. The default user in Raspbian is pi, which may not have sufficient authority to execute certain functions. Use of sudo with the command will give sufficient authority. Syntax is sudo followed by the command. Example: sudo apt-get update .
Utility to download and install Linux (Raspbian) packages. Must be connect to the internet. Use the sudo command ahead of apt-get to ensure sufficient authority to install. Examples: 1) sudo apt-get the-package-name, 2) sudo apt-get install the-package-name, 3) sudo apt-get update, followed by sudo apt-get upgrade . The third example will download and upgrade the operating system to latest level.
Displays, or sets the date/time. Use the –help option to show all available parameters.