Install Apps on Ubuntu Linux Using the Terminal
In this article
To install an application on Ubuntu Linux using the terminal, you use the apt package manager with the command sudo apt install <package-name>. This downloads and installs the software from Ubuntu's official repositories, handling dependencies automatically. You'll need to know the exact package name, which you can find with apt search. This guide walks you through the entire process, from updating your system to verifying the installation.
What You'll Need
- A computer running Ubuntu (or a derivative like Linux Mint, though commands may vary slightly).
- An internet connection.
- A user account with sudo privileges (administrative rights).
- Basic familiarity with opening a terminal (press
Ctrl+Alt+Tto open one).
Step-by-Step
- Open the terminal. Press
Ctrl+Alt+Ton your keyboard, or search for "Terminal" in the applications menu. - Update your package lists. Run
sudo apt update. This refreshes the list of available packages from the repositories. Enter your password when prompted (it won't show as you type). - Upgrade existing packages (optional but recommended). Run
sudo apt upgradeto install any pending updates. This helps avoid conflicts. If there are no updates, it will simply say so. - Find the exact package name. If you know the name, skip to step 5. Otherwise, search for it. For example, to find a media player, run
apt search media player. The output shows package names and short descriptions. Note the exact name (e.g.,vlc). - Install the package. Run
sudo apt install <package-name>, replacing<package-name>with the actual name. For example,sudo apt install vlc. - Confirm the installation. When prompted, type
Yand press Enter. The terminal will download and install the package and its dependencies. This may take a few minutes. - Verify the installation. After it finishes, you can launch the app by typing its command (e.g.,
vlc) in the terminal, or find it in your applications menu. To confirm it's installed, runapt list --installed | grep <package-name>.
Common Mistakes
- Forgetting
sudo. Without it, you'll get a "Permission denied" error. Always usesudofor installation. - Using the wrong package name. For example,
firefoxis correct, butfirefox-browsermay not exist. Always search first. - Skipping
apt update. If you don't update, you might get errors about missing packages or outdated versions. - Typing a capital letter. Package names are case-sensitive. Use lowercase unless the search shows otherwise.
- Mixing package managers. Don't use
apt-getandaptinterchangeably in the same session; stick toaptfor simplicity.
Tips
- Use tab completion. Type the first few letters of a package name and press
Tabto auto-complete it, avoiding typos. - Install multiple packages at once. Separate them with spaces:
sudo apt install vlc gimp inkscape. - Remove a package later. Use
sudo apt remove <package-name>to uninstall, orsudo apt purgeto also delete configuration files. - Check if a package is already installed. Run
apt list --installed | grep <package-name>. - Use the official repositories first. They are tested and secure. Only use third-party PPAs or .deb files from official sources when necessary.
Troubleshooting
If the installation fails, try these steps in order:
- Run
sudo apt updateagain. Sometimes the package list is stale. - Check for broken dependencies. Run
sudo apt --fix-broken install. This repairs missing or broken dependencies. - Clear the apt cache. Run
sudo apt cleanand thensudo apt update. - If you get a "Unable to locate package" error, the package may not be in the default repositories. Search online for the official installation method for that specific app (e.g., a PPA or a .deb download from the vendor's website).
- If the app won't launch after installation, try running its command from the terminal to see error messages. For example, type
vlcand look for output.
Frequently Asked Questions
How do I know the exact package name?
Use apt search <keyword>. For example, apt search video editor lists all packages related to video editing. The package name is the first word on each line.
Can I install apps from the Ubuntu Software Center using the terminal?
Yes, but the terminal installs the same packages directly. The Software Center is a graphical front-end for apt. You can also use snap for some apps (e.g., sudo snap install spotify), but this guide focuses on apt.
What's the difference between apt and apt-get?
apt is a newer, more user-friendly command that combines the functionality of apt-get and apt-cache. For basic installs, they are interchangeable, but apt is recommended for beginners.
Do I need to be connected to the internet?
Yes, apt downloads packages from online repositories. If you're offline, installation will fail.
How do I uninstall an app?
Use sudo apt remove <package-name>. To also delete configuration files, use sudo apt purge <package-name>.
Is it safe to install apps this way?
Yes, as long as you use packages from Ubuntu's official repositories or from trusted sources. Avoid third-party PPAs unless you know they are reliable.