Sometimes it’s hard to keep track of all the Raspberry Pi commands you use, so I created a list of some of the most useful and important ones that will make using Linux on the Raspberry Pi a lot easier.
Synchronizes the list of packages on your system to the list in the repositories. Use it before installing new packages to make sure you are installing the latest version.
Upgrades all of the software packages you have installed.
Clears previously run commands and text from the terminal screen.
Prints the current date.
Searches the whole system for the file example.txt and outputs a list of all directories that contain the file.
find / -name example.txt
Opens the file example.txt in the Linux text editor Nano.
To shutdown immediately.
Opens the configuration settings menu.
To reboot immediately.
To shutdown immediately.
shutdown -h now
To shutdown at 1:22 AM.
shutdown -h 01:22
Opens the GUI (Graphical User Interface).
Displays the contents of the file example.txt.
Changes the current directory to the /abc/xyz directory.
Copies examplefile.txt in the current directory and pastes it into the /home/pi/office directory.
cp examplefile.txt /home/pi/office/
Lists files in the current directory.
Creates a new directory named example_directory inside the current directory.
Moves examplefile.txt in the current directory to the /home/pi/office directory.
mv examplefile.txt /home/pi/office/
Deletes the file example.txt.
Deletes the directory example_directory (only if it is empty).
Creates a new, empty file named example.txt in the current directory.
To check the status of the wireless connection you are using (to see if wlan0 has acquired an IP address).
To check which network the wireless adapter is using.
Prints a list of the currently available wireless networks.
iwlist wlan0 scan
Scans your network and lists connected devices, port number, protocol, state (open or closed) operating system, MAC addresses, and other information.
Tests connectivity between two devices connected on a network. For example, ping 10.0.0.32 will send a packet to the device at IP 10.0.0.32 and wait for a response. It also works with website addresses.
Downloads the file example.txt from the web and saves it to the current directory.
Shows details about your memory.
Shows the size and number of partitions on your SD card or hard drive.
Shows you which version of the Raspberry Pi you are using.
Shows information about the available disk space.
Shows how much free disk space is available.
Shows all of the installed packages that are related to XXX.
dpkg – –get–selections | grep XXX
Shows all of your installed packages.
dpkg – –get–selections
Shows how much free memory is available.
Shows the IP address of your Raspberry Pi.
Lists USB hardware connected to your Raspberry Pi.
Pressing the UP key will print the last command entered into the command prompt. This is a quick way to repeat previous commands or make corrections to commands.
Shows the temperature of the CPU.
Shows the memory split between the CPU and GPU.
vcgencmd get_mem arm && vcgencmd get_mem gpu
Hopefully this list of commands will make navigating Linux on your Raspberry Pi more efficient and enjoyable. If you have any other commands that you use a lot,
you can tell me via Email: email@example.com or use my contact form
And be sure to subscribe to my newsletter to get an email when I publish new articles!