Sign up Log in
n/ubuntu · 26d ago · 257 views
u/BearPawMaster
n/ubuntuu/BearPaw · 26d ago

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

App Center is great when you just want to click and install, but when you actually need to troubleshoot, install in bulk, or reproduce an environment, APT (Advanced Package Tool) in the terminal is far more reliable: it's fast, gives you the full picture, and you can script it.

1. The three core commands

Step one: refresh the package list

sudo apt update

Note: this does not update any software. It just asks the servers "what's been updated? what are the latest version numbers?" Think of it as refreshing the menu.
Worth running before every install.

Step two: upgrade everything

sudo apt upgrade

This is the step that actually downloads and installs updates. It lists the packages to be upgraded — hit Y to confirm.

If you see a notice about dependency changes, or some packages being "kept back", don't force it right away. Read the output first, then decide whether you need a more aggressive upgrade path (say, when kernels or drivers are involved).

Step three: install software

sudo apt install 软件名

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

2. Searching and removing

Searching

Don't know the exact package name?

apt search 关键词

e.g. apt search python. The list can get long — piping it through grep helps a lot.

Removing software

sudo apt remove 软件名

This keeps your config files.

If you want it gone completely, config files included:

sudo apt purge 软件名

Cleaning up junk

Installing software pulls in a bunch of dependency packages, and removing the software may leave them behind.

sudo apt autoremove

Run this every so often to free up disk space.

3. PPAs: expanding your software library

Packages in the official repos are stable, but they can be old. A PPA (Personal Package Archive) is a repository maintained by an individual, letting you install the newest version of a piece of software.

One warning: PPAs are convenient, but they also mean handing part of your system's updates to a third party. If the official repos or official channels can do the job, use those first.

For example, installing the latest OBS Studio:

# 1. 添加 PPA 源
sudo add-apt-repository ppa:obsproject/obs-studio

# 2. 刷新列表 (现在新版 Ubuntu 会在添加 PPA 后自动刷新,但手动刷一下也没坏处)
sudo apt update

# 3. 安装
sudo apt install obs-studio

4. Switching mirrors: speeding up downloads

The default Ubuntu package servers are overseas, so connections from China can be painfully slow. We can switch to a domestic mirror (Aliyun, Tsinghua, USTC).

Switching mirrors in the GUI (recommended)

1. Open "Software & Updates".
2. In the "Download from" dropdown, pick "Other..." -> "China".
3. Click "Select Best Server" and it'll test speeds automatically.
4. Pick the fastest one and click "Choose Server".
5. When you close the window it'll prompt you to Reload — just confirm.

Switching mirrors from the command line (advanced)

Edit /etc/apt/sources.list and replace the domains in it with those of a domestic mirror.
(Since this means editing system files, beginners should stick to the GUI.)

Once you've got APT down, you've got the essence of Linux software management. One line and the install is done — way nicer than hunting down installers on some webpage.

Ubuntu for Beginners · Contents

01. Why choose Linux/Ubuntu?

02. Preparing for Ubuntu and choosing an install method

03. Step by step: installing Ubuntu 24.04 LTS

04. A first look at the GNOME desktop

05. Installing and managing software: goodbye, .exe

06. Setting up a Chinese locale and input methods

07. Office and productivity tools

08. Your first steps in the Linux terminal

09. Linux file permissions and user management

10. The text editor debate: getting started with Nano and Vim

Translated by AI from 简体中文

1
2
Log into join the discussion.

2 replies

Sort order
  1. ytmm 💬 Gold n/fitness Node owner 26d ago

    A very detailed beginner's tutorial

    Translated by AI from 简体中文

    0
  2. loc-yes Diamond Diamond member 26d ago

    Old devices, I still prefer APKs

    Translated by AI from 简体中文

    0