Skip to main content

How to do Basic Commands in Terminal

Raspberry Pi Terminal Command Cheat Sheet

Command Description
ls List all files and directories in the current folder
cd foldername Change to a specific directory
cd .. Go up one directory
mkdir myfolder Create a new directory called myfolder
rm myfile.txt Delete a file called myfile.txt
rm -r myfolder Delete a folder and its contents
cp file1.txt file2.txt Copy file1.txt to file2.txt
mv file.txt folder/ Move file.txt into the folder
nano script.py Edit a Python script using the built-in text editor
python3 script.py Run a Python 3 script
chmod +x script.sh Make a shell script executable
./script.sh Run an executable shell script
sudo shutdown now Shutdown the Raspberry Pi immediately
sudo reboot Reboot the Raspberry Pi
clear Clear the terminal screen
sudo apt update Update the list of available packages
sudo apt upgrade Upgrade installed packages to the latest version
sudo apt install package-name Install a software package (e.g., python3-opencv)
git clone https://github.com/user/repo.git Download a GitHub repository to your local Pi