Linux Basics

Package Managers (apt)

Forget downloading .exe installers from random websites. In Linux, you install software using a Package Manager. It's like an app store built directly into your terminal.


What is a Package Manager?

A package manager downloads software from official, secure servers (repositories) maintained by the creators of your Linux distribution. It automatically handles downloading the software, putting the files in the right places (/usr/bin/, etc.), and installing any dependencies the software needs to run.

On Ubuntu, Debian, and Raspberry Pi OS, the default package manager is called apt (Advanced Package Tool).


The 3 Essential apt Commands

Because installing and updating software affects the whole system, you must run all apt commands with sudo.

1. Update the Repository List

Before installing anything, you should update your local database to ensure you know about the latest versions of software available on the servers. This does not upgrade your software; it just updates the list.

bash
sudo apt update

(You should run this before starting any toolchain setup tutorial!)

2. Install a Package

To install a new program, use install followed by the package name. For example, to install git and python3:

bash
sudo apt install git python3

The package manager will calculate how much space it needs, list any extra dependencies it needs to install, and ask you to confirm [Y/n]. You can bypass the confirmation by adding the -y flag:

bash
sudo apt install -y cmake ninja-build

3. Upgrade Installed Software

To actually upgrade all the software on your computer to the latest versions found during apt update:

bash
sudo apt upgrade

Removing Software

If you no longer need a program, you can remove it cleanly.

bash
# Remove the program itself
sudo apt remove git

# Remove the program AND its configuration files
sudo apt purge git

# Clean up dependencies that were installed automatically 
# but are no longer needed by any program
sudo apt autoremove

Other Package Managers

While apt is the system package manager for Ubuntu, you will often use language-specific package managers in embedded development:

  • pip: The package manager for Python. You use this to install libraries like numpy or esptool. (e.g., pip install esptool).
  • npm: The package manager for Node.js/JavaScript.
  • cargo: The package manager for Rust.

Now that you understand the Linux basics, let's learn how to write basic Shell Scripts to automate these commands.

Previous
Permissions & Sudo