11. Software Management from the Ubuntu Command Line (APT)

App Center is great for installing software with just a few clicks, but when it comes to troubleshooting, batch installation, and reproducing environments, APT (Advanced Package Tool) in the terminal is more reliable: it’s fast, informative, and scriptable.

1. The Three Essential Commands

Step 1: Update the Package Lists

sudo apt update

Note: This step does not update your software. It simply asks the server: “What software updates are available now? What are the latest version numbers?” It’s like refreshing a menu.
It’s recommended to run this before installing software each time.

Step 2: Upgrade All Software

sudo apt upgrade

This is the step that actually downloads and installs updates. The system will list the packages that need upgrading; press Y to confirm.

If you see a prompt about dependency changes, or some packages being “kept back,” don’t force it right away. Read the output carefully first, then decide whether a more aggressive upgrade method is necessary (for example, when the kernel or drivers are involved).

Step 3: Install Software

sudo apt install 软件名

For example: sudo apt install git vim vlc (you can install multiple packages at once).

2. Searching and Uninstalling

Search for Software

Don’t know the exact name of a package?

apt search 关键词

For example, apt search python. The list may be quite long, so using it together with grep works even better.

Uninstall Software

sudo apt remove 软件名

This keeps the configuration files.

To remove everything completely, including configuration files:

sudo apt purge 软件名

Clean Up Unneeded Packages

Installing software automatically downloads many dependency packages. When the software is uninstalled, some of these dependencies may remain.

sudo apt autoremove

Running this command regularly can free up disk space.

3. PPA: Expand Your Software Repositories

Software in the official repositories is stable, but its versions may be outdated. PPA (Personal Package Archives) are personally maintained software repositories that let you install the latest versions of software.

One reminder: PPAs are convenient, but they also mean that part of your system’s updates are maintained by a third party. Whenever the official repository or channel can solve the problem, try to use it first.

For example, to install the latest version of OBS Studio:

# 1. Add the PPA
sudo add-apt-repository ppa:obsproject/obs-studio

# 2. Refresh the list (newer versions of Ubuntu automatically refresh it after adding a PPA, but manually refreshing it doesn’t hurt)
sudo apt update

# 3. Install
sudo apt install obs-studio

4. Change Mirrors: Speed Up Downloads

Ubuntu’s default software repository servers are located overseas, so connections from China may be slow. We can switch to a mirror in China, such as Alibaba Cloud, Tsinghua University, or USTC.

Change Mirrors via the GUI (Recommended)

1. Open “Software & Updates”.
2. In the “Download from” drop-down menu, select “Other…” → “China”.
3. Click “Select Best Server”; the system will automatically test the speeds.
4. Select the fastest one and click “Choose Server”.
5. When closing the window, the system will prompt you to reload the package information. Confirm it.

Change Mirrors via the Command Line (Advanced)

Edit the /etc/apt/sources.list file and replace the domain names in it with those of a Chinese mirror.
(Because this involves modifying system files, beginners are advised to use the graphical interface.)

Once you master APT, you’ll have grasped the essence of Linux software management. Installing software with a single command is much more satisfying than visiting a website to download an installer.

Beginner’s Ubuntu Tutorial · Contents

01. Why Choose Linux/Ubuntu?

02. Ubuntu Preparation and Choosing an Installation Method

03. A Step-by-Step Guide to Installing Ubuntu 24.04 LTS

04. An Introduction to the GNOME Desktop Environment

05. Installing and Managing Software: Say Goodbye to .exe

06. Configuring Chinese Language Support and Input Methods

07. Office and Productivity Tools

08. Getting Started with the Linux Terminal

09. Linux File Permissions and User Management

10. The Text Editor Debate: An Introduction to Nano and Vim

1 Like

A very detailed beginner’s tutorial

Old devices still prefer APKs.