🐧 2. Raspberry Pi – Linux Environment
Estimated reading: 4 minutes 713 views

Raspberry Pi – Working with Linux: Beginner’s Command Line Guide (2025)


Introduction – Why Learn Linux on Raspberry Pi?

Raspberry Pi runs Linux-based operating systems like Raspberry Pi OS, Ubuntu, and others. Understanding how to work with Linux is essential for programming, system control, automation, and hardware interfacing on your Pi.

In this guide, you’ll learn:

  • How to navigate Linux on Raspberry Pi
  • Common command-line tools and terminal basics
  • File, user, and system management commands
  • How to install software and update your Pi
  • Practical Linux use cases on Raspberry Pi projects

What Is Linux on Raspberry Pi?

Linux is a powerful, open-source operating system that powers Raspberry Pi. The most common distro is Raspberry Pi OS, a Debian-based system with a PIXEL desktop. Whether you use the GUI or SSH remotely, all serious Pi work involves Linux under the hood.

Linux lets you:

  • Run Python, C, Node.js, and Bash scripts
  • Access GPIO, I2C, SPI devices
  • Install packages with APT
  • Schedule tasks and automate systems
  • Secure and network your Pi

How to Access the Linux Terminal

You can access the terminal in three main ways:

MethodHow to Use
DesktopClick the Terminal icon on the PIXEL taskbar
Headless SSHUse ssh pi@<IP_ADDRESS> from another computer
Lite OSBoots directly into CLI (command-line interface)

Tip: Use CTRL+ALT+T to open terminal quickly on Raspberry Pi Desktop.


Basic Linux File Commands

Command Purpose
pwdShow current directory
lsList files and folders
cd <folder>Change directory
mkdir <name>Create a new folder
touch <file>Create an empty file
rm <file>Delete a file
cp <src> <dest>Copy files or folders
mv <src> <dest>Move or rename files

Example:

cd /home/pi
mkdir projects
touch hello.py

User & Permission Commands

Command Purpose
whoamiShows the current user
sudoRun a command with root privileges
passwdChange your password
chmod +x <file>Make a script or file executable
chown pi:pi <file>Change file owner to user ‘pi’

Best practice: Avoid logging in as root. Use sudo when elevated access is needed.


Installing & Updating Software

Use APT (Advanced Package Tool) to install and manage software:

sudo apt update         # Updates package list
sudo apt upgrade        # Installs latest available updates
sudo apt install <name> # Installs a new package

Example:

sudo apt install git
sudo apt install python3-pip

You can also install .deb files or use snap on Ubuntu-based systems.


Editing Files with Nano

To edit configuration files or scripts:

nano <filename>

Example:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Use:

  • CTRL+O to save
  • CTRL+X to exit
  • CTRL+W to search

Rebooting & Shutting Down

Command Action
sudo rebootRestart Raspberry Pi
sudo shutdown nowShutdown immediately
sudo shutdown -h nowShutdown and halt
sudo shutdown -r nowReboot immediately

️ Schedule shutdown:

sudo shutdown +30

(This will shutdown in 30 minutes.)


GPIO Access from Linux

You can toggle GPIO pins directly using command-line tools like:

gpio -g mode 17 out
gpio -g write 17 1

Or using Python with RPi.GPIO:

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, GPIO.HIGH)

Make sure to install:

sudo apt install python3-rpi.gpio

Summary – Recap & Next Steps

Mastering the Linux terminal opens up the real power of Raspberry Piβ€”from running code and managing files to configuring hardware and automation. Once you’re comfortable, Raspberry Pi becomes a full Linux development and electronics platform.

Key takeaways:

  • Raspberry Pi runs on Linux (Raspberry Pi OS, Ubuntu, etc.)
  • Command line skills are essential for real Raspberry Pi usage
  • Use terminal to manage files, users, software, and scripts
  • Tools like nano, apt, and sudo are frequently used
  • You can access GPIO, automate tasks, and manage devices with ease

Real-world relevance: Linux skills on Raspberry Pi directly translate to cloud servers, embedded systems, and professional DevOps workflows.


FAQs – Working with Linux on Raspberry Pi

Is Raspberry Pi OS based on Linux?

Yes. Raspberry Pi OS is a Debian-based Linux distribution optimized for ARM architecture.


Do I need to know Linux to use Raspberry Pi?

Basic knowledge is highly recommendedβ€”especially for headless, GPIO, or coding projects.


Can I use Raspberry Pi without a monitor?

Yes, using SSH from another device. Place a file named ssh in the /boot partition of the SD card.


What’s the difference between apt update and apt upgrade?

update refreshes the package list; upgrade installs the latest versions of your installed software.


How do I run a Python script from terminal?

Use:

python3 script.py

Make sure the file is executable or invoke it directly using Python.


Share Now :
Share

πŸ’» Raspberry Pi – Working with Linux

Or Copy Link

CONTENTS
Scroll to Top