0% found this document useful (0 votes)
17 views2 pages

Terminal+Commands+ +Raspberry+Pi+Course

This document is a cheat-sheet of terminal commands for Raspberry Pi, covering navigation, file manipulation, software installation, and other useful commands. It includes commands for listing directories, creating and removing files, installing packages, and executing Python scripts. Additionally, it provides tips for efficient command usage and handling command execution times.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Terminal+Commands+ +Raspberry+Pi+Course

This document is a cheat-sheet of terminal commands for Raspberry Pi, covering navigation, file manipulation, software installation, and other useful commands. It includes commands for listing directories, creating and removing files, installing packages, and executing Python scripts. Additionally, it provides tips for efficient command usage and handling command execution times.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Terminal Commands - Quick cheat-sheet

Here is a list of commands to keep on the side when you work on this Raspberry Pi course.

Navigation
ls Print the content of a directory

ls -a Same as ls, but also shows hidden files

pwd Print the directory where you are now

cd <dir_name> Navigate to directory

Manipulate files
nano <file_name> Open the file in nano editor, also create the file if
doesn’t exist

touch <file_name> Create a new file

mkdir <dir_name> Create a new directory

mv <file_path> <new_file_path> Move a file and/or rename it

cp <file_path> <new_file_path> Copy a file to a new file

rm <file_name> Remove a file

rm -r <dir_name> Remove a directory and everything inside, recursively

cat <file_name> Print the content of a file

Install software
sudo apt update Update sources to latest

sudo apt install <package_name> Install a package

sudo apt remove <package_name> Remove a package

sudo apt upgrade Upgrade already installed packages to latest version

sudo apt autoremove Remove packages that are not needed anymore
Install Python modules
sudo apt install python3-<module> Install a Python module with apt (recommended)

pip3 install <module> Install a Python module with pip3

sudo apt remove python3-<module> Remove a Python module with apt

pip3 uninstall <module> Remove a Python module with pip3

pip3 list Print all installed Python modules

Other useful commands


sudo shutdown now Shutdown the Raspberry Pi

sudo reboot Reboot the Raspberry Pi

hostname -I Print IP address of the RPi

df -h Print currently used and available space on SD card

python3 <file_name.py> Execute a Python 3 script in the terminal

man <command_name> Manual for a given command

A few additional notes


- Use auto completion as much as you can (press TAB), this will save you a lot of time.
- To go back to previously executed commands, use the up arrow key on your keyboard.
- No need to add a .txt extension to create a text file, you can use whatever extension you
want, or not use any.
- Some commands are very quick to execute and return directly (ex: “pwd”). Other
commands can take some time (ex: “sudo apt upgrade” or running a Python script).
Press CTRL+C to stop a running command.

You might also like