Installing Software from the Terminal

Welcome back.
In the previous lesson, you learned about permissions and sudo.
Now we use that power for something useful:
Installing software.
Because clicking “Next, Next, Next, Finish” is fine, but installing software from the terminal feels like ordering tools directly from the command-line universe.
Very efficient.
Slightly dramatic.
What You’ll Learn
In this lesson, you’ll learn:
- what a package manager is;
- how to install software on Arch Linux;
- how to install software on Ubuntu or Debian;
- how to install software on Fedora;
- how to search for packages;
- how to remove packages;
- how to update your system safely.
The Mission
Your mission is simple:
Install a small terminal program, check that it works, and learn how package managers help keep your system organized.
Today we install software.
Not chaos.
Software.
What Is a Package Manager?
A package manager is a tool that installs, updates, and removes software.
Instead of downloading random files from random websites, you ask your Linux system:
“Please install this program properly.”
And the package manager handles:
- downloading the package;
- installing dependencies;
- placing files in the correct locations;
- updating the program later;
- removing it when you no longer need it.
A package manager is like a very organized librarian.
Except instead of books, it manages programs.
And it does not judge your browser tabs.
Probably.
Different Linux Systems, Different Package Managers
Different Linux distributions use different package managers.
Common examples:
Arch Linux pacman
Ubuntu/Debian apt
Fedora dnf
The idea is the same.
The commands are different.
Linux likes variety. Sometimes too much variety. Like a buffet where every table has different rules.
Before Installing: Update Package Information
Before installing software, it is often a good idea to update your package information.
Arch Linux
On Arch Linux, update the whole system with:
sudo pacman -Syu
Important: on Arch, avoid partial upgrades. If you update, update the full system.
Arch is powerful, but it does not enjoy half-finished conversations.
Ubuntu or Debian
On Ubuntu or Debian, first update the package list:
sudo apt update
Then upgrade installed packages:
sudo apt upgrade
Fedora
On Fedora, upgrade the system with:
sudo dnf upgrade
This keeps your installed software up to date.
Install a Program
Let’s install htop.
htop is a terminal program that shows running processes and system usage.
It is like top, but friendlier.
A little dashboard for people who enjoy watching their CPU have feelings.
Arch Linux
sudo pacman -S htop
Ubuntu or Debian
sudo apt install htop
Fedora
sudo dnf install htop
After installation, run it:
htop
To quit htop, press:
q
Yes, again q.
Linux tools love q.
It is the emergency exit of terminal life.
Check If a Program Exists
To check if a command exists, use:
command -v htop
You may see something like:
/usr/bin/htop
That means the command exists.
You can also try:
htop --version
Some programs support --version.
Some do not.
Programs have personalities. Not always pleasant ones.
Search for Packages
Sometimes you do not know the exact package name.
You can search.
Arch Linux
pacman -Ss htop
Ubuntu or Debian
apt search htop
Fedora
dnf search htop
Search helps you find available packages.
This is much better than guessing package names like a wizard throwing pasta at a wall.
Show Package Information
You can also inspect package information.
Arch Linux
pacman -Si htop
For an installed package:
pacman -Qi htop
Ubuntu or Debian
apt show htop
Fedora
dnf info htop
This can show:
- version;
- description;
- dependencies;
- repository;
- installed size.
Useful when you want to know what you are installing before inviting it into your system.
Very polite. Very adult.
Remove a Program
If you no longer need a program, remove it.
Arch Linux
sudo pacman -Rns htop
-Rns removes the package and dependencies that are no longer needed.
Use it with attention.
Ubuntu or Debian
sudo apt remove htop
Then remove unused dependencies:
sudo apt autoremove
Fedora
sudo dnf remove htop
Removing software is normal.
Your system does not need to become a museum of every program you ever tried at 2 a.m.
Install Another Useful Tool
Try installing tree.
tree shows folders and files in a tree structure.
Arch Linux
sudo pacman -S tree
Ubuntu or Debian
sudo apt install tree
Fedora
sudo dnf install tree
Now run:
tree ~/terminal-practice
You may see a nice structure of your practice folder.
Finally, your folders look organized.
At least on the screen.
Your real Downloads folder may still need therapy.
Common Mistakes
Forgetting sudo
This may fail:
pacman -S htop
or:
apt install htop
or:
dnf install htop
Installing software usually needs administrator privileges.
Use:
sudo pacman -S htop
or:
sudo apt install htop
or:
sudo dnf install htop
But remember: sudo is power.
Use it because you need it, not because it looks cool.
Using the Wrong Package Manager
This will not work on Arch:
sudo apt install htop
This will not work on Ubuntu:
sudo pacman -S htop
Use the package manager for your distribution.
Linux is flexible, but not that flexible.
Installing Without Reading
Before confirming installation, read what the package manager says.
It may tell you:
- which packages will be installed;
- which dependencies are needed;
- how much space will be used;
- whether something will be removed.
Do not just press Enter like a tired pigeon.
Read first.
Then press Enter like a professional tired pigeon.
Practice
Install tree.
Arch Linux
sudo pacman -Syu
sudo pacman -S tree
tree --version
tree ~/terminal-practice
Ubuntu or Debian
sudo apt update
sudo apt install tree
tree --version
tree ~/terminal-practice
Fedora
sudo dnf upgrade
sudo dnf install tree
tree --version
tree ~/terminal-practice
Then answer:
- What is a package manager?
- Which package manager does Arch Linux use?
- Which package manager does Ubuntu use?
- Which package manager does Fedora use?
- Why do installation commands often need
sudo?
Mini Challenge
Install two useful terminal tools:
htoptree
Then:
- Run
htop. - Quit
htopwithq. - Run
tree ~/terminal-practice. - Check where
treeis installed withcommand -v tree. - Search for another package using your package manager.
No mouse.
At this point, the mouse is not unemployed.
It is retired.
Summary
Today you learned:
- package managers install, update, search, and remove software;
- Arch Linux uses
pacman; - Ubuntu and Debian use
apt; - Fedora uses
dnf; sudois often needed for installing software;htopshows running processes;treeshows folders in a tree structure;- you should read package manager output before confirming.
Installing software from the terminal is one of the best Linux skills.
It is fast, clean, and powerful.
Also, it makes you look like you know what you are doing.
Which, after this lesson, is becoming dangerously true.
Next Lesson
In the next lesson, we’ll learn about processes and system monitoring.
We will see what is running, what is using resources, and how to stop programs when they misbehave.
Because sometimes software needs a polite conversation.
And sometimes it needs kill.