| Very often |
ssh |
Connects to another computer over the network and gives you its terminal. |
ssh name@host.local |
-p = use another port,
-i = use a key file |
| Very often |
ls |
Shows the files and folders in the current folder. |
ls |
-l = detailed list,
-a = show hidden files,
-h = human-readable sizes |
| Very often |
cd |
Changes to another folder. |
cd ~/bme280_logger |
cd .. = go one folder up,
cd ~ = go home,
cd - = go back to last folder |
| Very often |
pwd |
Shows where you are right now in the file system. |
pwd |
No common flags needed for beginners |
| Very often |
sudo |
Runs a command with administrator rights. You need it for important system changes. |
sudo apt update |
Use with care: it gives a command more power |
| Very often |
nano |
Opens a simple text editor in the terminal. |
nano test_bme280.py |
Ctrl+O = save,
Ctrl+X = exit |
| Very often |
clear |
Clears the terminal screen. |
clear |
Ctrl+L does nearly the same thing |
| Very often |
mkdir |
Creates a new folder. |
mkdir logs |
-p = also create parent folders if needed |
| Very often |
touch |
Creates an empty file. |
touch notes.txt |
Also updates the file time if the file already exists |
| Very often |
cp |
Copies a file or folder. |
cp test.py backup.py |
-r = copy folders too,
-v = show what is being copied |
| Very often |
mv |
Moves a file/folder or renames it. |
mv old.txt new.txt |
Same command for moving and renaming |
| Very often |
rm |
Deletes a file or folder. |
rm old.txt |
-r = delete folders too,
-f = force delete,
-i = ask before deleting |
| Very often |
cat |
Prints the content of a file to the terminal. |
cat config.txt |
Good for short files; bad for very long files |
| Very often |
tail |
Shows the last lines of a file. Very useful for logs. |
tail log.txt |
-f = keep watching for new lines live |
| Very often |
head |
Shows the first lines of a file. |
head log.txt |
Useful for quick checks |
| Very often |
python / python3 |
Runs a Python script. |
python3 test_bme280.py |
On Raspberry Pi,
python3 is usually the safe choice |
| Often |
apt update |
Downloads the newest package lists. It does not install updates yet. |
sudo apt update |
Usually run before upgrade or install |
| Often |
apt upgrade |
Installs available updates for installed software. |
sudo apt upgrade |
-y = answer “yes” automatically |
| Often |
apt full-upgrade |
Does a bigger system update and may replace or remove packages if needed. |
sudo apt full-upgrade -y |
Useful for full system maintenance |
| Often |
apt install |
Installs new software packages. |
sudo apt install -y i2c-tools |
-y = skip the confirmation question |
| Often |
apt remove |
Removes installed software packages. |
sudo apt remove package-name |
Removes software, but sometimes leaves config files behind |
| Often |
find |
Searches for files and folders. |
find . -name "*.py" |
. means “start here” |
| Often |
grep |
Searches for text inside files or command output. |
grep error log.txt |
-i = ignore upper/lower case,
-r = search inside folders too |
| Often |
less |
Opens a file for easy reading, one screen at a time. |
less long_log.txt |
Press q to quit |
| Often |
history |
Shows your previous commands. |
history |
Very useful when you forgot what you typed earlier |
| Often |
!! |
Runs the last command again. |
sudo !! |
Classic trick: rerun the last command with sudo |
| Often |
python3 -m venv .venv |
Creates a Python virtual environment for a project. |
python3 -m venv .venv |
Keeps project Python packages separate and tidy |
| Often |
source .venv/bin/activate |
Activates the virtual environment. |
source .venv/bin/activate |
After that, Python and pip use the virtual environment |
| Often |
jobs |
Shows programs running in the background in your current terminal. |
jobs |
Useful after starting a script with & |
| Often |
fg |
Brings a background job back to the front. |
fg |
Good if you want to stop it with Ctrl+C |
| Often |
& |
Starts a command in the background. |
python3 logger.py & |
The terminal stays usable after starting the program |
| Regularly |
reboot |
Restarts the Raspberry Pi. |
sudo reboot |
Useful after updates or config changes |
| Regularly |
shutdown |
Turns the Raspberry Pi off safely. |
sudo shutdown -h now |
-h = halt/power off,
-r = reboot |
| Regularly |
raspi-config |
Opens Raspberry Pi settings like SSH, I2C, SPI, hostname and more. |
sudo raspi-config |
Very important on Raspberry Pi systems |
| Regularly |
ip a |
Shows network information like IP addresses. |
ip a |
Good when you want to know how the Pi is connected |
| Regularly |
hostname |
Shows the computer name. |
hostname |
Useful for SSH and network setup |
| Regularly |
ping |
Tests whether another device or website can be reached over the network. |
ping raspberrypi.com |
Press Ctrl+C to stop it |
| Regularly |
i2cdetect -y 1 |
Scans the I2C bus and shows connected I2C devices like the BME280. |
i2cdetect -y 1 |
Needs i2c-tools installed; on Raspberry Pi, bus 1 is the normal one |
| Regularly |
ps aux |
Shows running processes. |
ps aux |
Useful when you want to find a running script |
| Regularly |
top |
Shows live system activity like CPU, memory and running processes. |
top |
Press q to quit |
| Regularly |
htop |
A friendlier and clearer version of top. |
htop |
May need installation first: sudo apt install htop |
| Sometimes |
kill |
Stops a running process by its process ID. |
kill 1234 |
-9 = force stop; use only if normal stop fails |
| Sometimes |
man |
Shows the manual page for a command. |
man ls |
Good when you want the official explanation |
| Sometimes |
--help |
Shows a short help text for many commands. |
ls --help |
Faster than reading the full manual page |
| Sometimes |
Ctrl+C |
Stops the currently running command. |
python3 logger.py then press Ctrl+C |
Extremely important in daily terminal use |
| Sometimes |
TAB |
Auto-completes file names and commands. |
Type cd Doc and press TAB |
Saves time and avoids typing mistakes |
| Sometimes |
Arrow Up |
Shows your previous command in the terminal. |
Press ↑ |
Perfect for repeating or editing old commands |
| Important flags |
-r |
Recursive. Usually means “also go through folders and everything inside them”. |
cp -r myfolder backup/ |
Common with cp,
rm,
grep |
| Important flags |
-f |
Force. Do it without asking, even if it may be risky. |
rm -f file.txt |
Dangerous with delete commands |
| Important flags |
-y |
Automatically answer “yes” to questions. |
sudo apt install -y i2c-tools |
Useful in package management |
| Important flags |
-i |
Interactive. Usually asks before doing something risky. |
rm -i file.txt |
Good for safer deleting |
| Important flags |
-v |
Verbose. Shows more details about what the command is doing. |
cp -v a.txt b.txt |
Useful when learning |
| Important flags |
-h |
Human-readable. Shows file sizes in an easy form like KB, MB, GB. |
ls -lh |
Very handy when checking file sizes |
| Important flags |
-a |
Shows all files, including hidden ones. |
ls -a |
Hidden files often start with a dot, like .bashrc |
| Important flags |
-l |
Long format. Shows more details like permissions, owner and size. |
ls -l |
Often combined as ls -lah |