Installing Specific Packages without Recommended Ones using apt

Abstract: Prevent apt from installing recommended dependencies to reduce disk usage and system bloat.

Created: 2026-08-20 by

Use the --no-install-recommends flag with the apt install command to prevent APT from automatically pulling in suggested dependencies. This ensures a minimal installation by ignoring packages marked as recommended but not strictly required for core functionality, reducing disk usage and potential conflicts.

Understanding Recommended Packages in Debian-Based Systems

In the Debian ecosystem, which includes Ubuntu, package relationships are categorized into several types: Depends, Recommends, Suggests, and Enhances. The Depends field contains packages that are absolutely necessary for the software to function correctly. If these are missing, the installation will fail or the application may crash. However, the Recommends field is different. It lists packages that the maintainers believe most users will want, but they are not technically required. By default, modern versions of APT treat Recommends as almost mandatory. When you run a standard installation command, APT resolves the dependency tree, identifies the recommended packages, and installs them alongside your target software. This behavior is designed to provide a seamless user experience out-of-the-box. For example, installing a web browser might also pull in helper utilities for handling specific file types or codecs, even if you do not intend to use them immediately. While this convenience is helpful for desktop environments, it can be undesirable for servers, containers, or users who prefer strict control over their system footprint.

The Command-Line Solution

The most direct way to bypass this automatic behavior is to append the --no-install-recommends option to your installation command. This flag tells APT to ignore the Recommends list entirely during the transaction. You should combine this with the -y flag to automatically answer yes to prompts, ensuring the script runs non-interactively if needed.
sudo apt update
sudo apt install --no-install-recommends -y package-name
Replace package-name with the actual name of the software you wish to install. For instance, if you are installing a text editor like nano, APT might normally suggest installing nano-syntax-highlighting. With the flag above, only the core nano binary will be installed. This method is idempotent and safe; it does not remove existing packages, it only prevents new ones from being added during this specific installation event.

Installing Multiple Packages at Once

You can apply this flag to multiple packages in a single command line. This is efficient when setting up a server environment where you want to minimize bloat across several tools.
sudo apt install --no-install-recommends -y nginx mysql-server postgresql
Each package in this list will be installed without its respective recommended dependencies. Note that if two packages share a common dependency listed under Depends rather than Recommends, that shared dependency will still be installed because it is critical for both applications. The --no-install-recommends flag only affects the softer relationship tier.

Configuring APT Permanently

If you frequently need minimal installations and find typing the long flag cumbersome, you can configure APT to behave this way by default. This is done by modifying the configuration files located in /etc/apt/. Specifically, you can create or edit a configuration file in the conf.d directory. Create a file named 99norecommends inside /etc/apt/apt.conf.d/. Add the following line to this file:
APT::Install-Recommends "false";
This global setting overrides the default behavior for all future apt install commands on the system. You do not need to specify the flag anymore. However, be cautious with this approach. Some graphical applications or complex services rely heavily on recommended packages for full feature parity. Disabling this globally might lead to broken features or missing functionality in certain apps. If you revert to default behavior later, you can simply delete or comment out that line. Alternatively, you can use the --install-recommends flag explicitly when you do want the extra packages. For more details on customizing APT's interactive behavior, see How to Make APT Install Always Ask for Confirmation?. This complements the current discussion by allowing you to control whether APT prompts you before making changes, adding another layer of safety to your package management workflow.

Downloading Packages Without Installing

Sometimes you may need to acquire the .deb files for offline installation or inspection without triggering any dependency resolution at all. In such cases, you can use the --download-only flag. This fetches the binaries but does not unpack or configure them.
sudo apt install --download-only --no-install-recommends package-name
This is useful for air-gapped systems or when building custom images. For a deeper dive into managing deb files across different architectures, refer to Download .deb packages for different os version + architecture with apt. Understanding how to handle these files manually gives you complete control over what enters your system, independent of APT's automated recommendation engine.

Verifying What Was Installed

After installation, it is good practice to verify that no unwanted packages were pulled in. You can check the history of transactions using apt-mark showmanual to see manually installed packages versus those marked as automatically installed.
apt-mark showauto | grep package-name
If the recommended packages were ignored, they should not appear in the auto-installed list unless they were hard dependencies. You can also review the log file at /var/log/apt/history.log to see exactly which packages were processed during the last transaction. This transparency helps in auditing your system for security and performance reasons.

Frequently Asked Questions

Will removing recommended packages break my application?

Generally, no. By definition, recommended packages are not required for the core application to run. However, some features might be missing or less functional if a recommended helper utility is absent. Always test critical functionality after a minimal install.

How do I reinstall the recommended packages later?

You can force APT to install them by running sudo apt install package-name without the --no-install-recommends flag. Since the main package is already present, APT will identify the missing recommendations and offer to install them.

Does this flag affect Dependent packages?

No. The --no-install-recommends flag only ignores the Recommends relationship. All packages listed under Depends, Pre-Depends, and Conflicts will still be resolved and installed as necessary.

Is there a GUI equivalent in Ubuntu Software Center?

Most graphical front-ends do not expose this option directly. You typically need to use the terminal for precise control over dependency resolution. Some advanced GUI managers might have settings to disable automatic suggestions, but the terminal method is the most reliable.

Can I use this with snap or flatpak?

No. This flag is specific to the APT package manager used by Debian-based distributions. Snap and Flatpak have their own sandboxing and dependency models that do not use the same recommendation metadata structure.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More