How7o
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: What Does the -y Flag Do in yum / dnf / apt-get?
Share
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > Server Management > What Does the -y Flag Do in yum / dnf / apt-get?
Server Management

What Does the -y Flag Do in yum / dnf / apt-get?

how7o
By how7o
Last updated: May 23, 2026
5 Min Read
yum/dnf -y flag explained
SHARE

The -y flag in yum -y update (and dnf -y install, apt-get -y install) means “assume yes to every prompt.” Without it, the package manager pauses to ask Is this OK? [y/N] before downloading or removing anything. With it, every such prompt auto-answers yes — handy in scripts and one-shot commands.

Contents
  • What you actually skip
  • Common uses
  • When NOT to use -y
  • Related flags worth knowing
  • Frequently asked questions
  • Related guides
  • References

Last verified: 2026-05-17 on AlmaLinux 9 (dnf) and Ubuntu 22.04 (apt). Originally published 2022-09-18, rewritten and updated 2026-05-17.

What you actually skip

sudo yum install httpd
# ...
# Total download size: 4.3 M
# Installed size: 12 M
# Is this ok [y/d/N]: ▍   <-- waits for input

sudo yum install httpd -y
# ...
# Is this ok [y/d/N]: y   <-- automatic
# (proceeds)

The prompt is asking you to confirm the dependency list and disk usage. -y tells yum/dnf to answer y automatically — no human in the loop.

Package manager -y flag — yum/dnf/apt-get auto-confirm, --assumeyes long form, when not to use

Common uses

# RHEL-family (yum/dnf)
sudo yum -y update
sudo dnf -y install httpd php php-mysqlnd
sudo dnf -y remove mariadb-server

# Debian/Ubuntu (apt)
sudo apt-get -y update
sudo apt-get -y install nginx
sudo apt-get -y dist-upgrade

The long-form equivalent is --assumeyes on yum/dnf, --assume-yes (or just --yes) on apt-get. Useful in scripts where you want to be explicit about non-interactive intent.

When NOT to use -y

  • First-time installs of an unfamiliar package. Package managers occasionally pull in surprising dependencies; reviewing the list once before approving is a small habit that catches a lot of problems.
  • Big upgrades that remove packages. dnf upgrade can decide to remove things to resolve conflicts. With -y it just does it — sometimes that’s what you want, sometimes the right move is to --exclude the conflict and resolve it manually.
  • Anywhere a typo would be expensive. The prompt is a sanity check; -y removes it. For a production server, take the extra second.

Related flags worth knowing

# Dry run — say no, see what would happen
sudo dnf install nginx --assumeno

# Download but don't install
sudo dnf install nginx --downloadonly

# Skip prompts AND ignore some failures
sudo apt-get -y install nginx --allow-downgrades

# Set frontend to noninteractive for the whole script
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install postfix

Frequently asked questions

Does dnf support -y the same way?

Yes — dnf (the package manager on RHEL 8+ and AlmaLinux/Rocky/Fedora) inherits -y from yum with identical behavior. --assumeyes is the long form. Same flag on apt-get (Debian/Ubuntu) too, where the long form is --assume-yes or --yes.

Is -y safe for production servers?

For routine updates of trusted repos, yes. For first-time installs of unfamiliar packages, prefer running without -y the first time so you can review the dependency list — package managers occasionally pull in unexpected extras. -y is a productivity flag, not a security one.

What’s the opposite — “assume no”?

--assumeno on yum/dnf, useful for dry runs. It answers “no” to every prompt, which effectively makes the command a no-op that shows you what would have happened. Combine with --downloadonly to fetch packages without installing them.

What does apt-get -y do differently?

Same idea, slightly different defaults. apt-get -y install foo auto-confirms install prompts. For changes that could remove other packages, apt-get requires --force-yes or --allow-downgrades in addition — a sane safety net. On Debian-family, apt (the newer command) has interactive defaults; for scripts, use apt-get with DEBIAN_FRONTEND=noninteractive.

Related guides

  • How to Install the Apache Web Server on Ubuntu
  • How to Install and Set Up HAProxy on AlmaLinux, Rocky, or RHEL
  • How to Install HandBrake CLI on Linux (Flatpak)

References

man dnf, man yum, man apt-get on any Linux. dnf documentation: dnf.readthedocs.io/en/latest/command_ref.html.

TAGGED:BashconfigurationLinux

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article URL.createObjectURL not a function — Chrome extension service worker fix Fix “URL.createObjectURL is not a function” in Chrome Extension Service Workers
Next Article Securely hash passwords in PHP with password_hash Securely Hash Passwords in PHP (password_hash, Argon2id)
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

FacebookLike
XFollow
PinterestPin
InstagramFollow
Most Popular
Run Laravel queue workers with Supervisor
How to Run Laravel Queue Workers in Production with Supervisor
May 23, 2026
Nginx as a reverse proxy for a Node.js app on Ubuntu
How to Set Up Nginx as a Reverse Proxy for Node.js on Ubuntu
May 23, 2026
Install and configure Redis on Ubuntu for Laravel and WordPress
How to Install and Configure Redis on Ubuntu (for Laravel & WordPress)
May 23, 2026
Harden a fresh Ubuntu VPS with UFW, Fail2Ban, and SSH key auth
How to Harden a Fresh Ubuntu VPS: UFW + Fail2Ban + SSH Key Auth
May 23, 2026
Set up Let's Encrypt SSL with Certbot on Ubuntu
How to Set Up Let’s Encrypt SSL with Certbot on Ubuntu (Apache & Nginx)
May 23, 2026

You Might Also Like

MariaDB restart on Linux — systemctl restart mariadb
Server Management

How to Restart the MariaDB Server on Linux

6 Min Read
Get a remote file size from URL in PHP with get_headers
Web Development

How to Get a Remote File’s Size from a URL in PHP

4 Min Read
JavaScript format number with decimals — toFixed, Math.floor, and Intl.NumberFormat
Web Development

How to Format a Number with Decimals in JavaScript

5 Min Read
Check if Laravel scheduler is running (cron + php artisan schedule:run)
Web Development

How to Check if Laravel Scheduler Is Running (Cron + Logs)

6 Min Read
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Tools

  • Age Calculator
  • Word Counter
  • Image Upscaler
  • Password Generator
  • QR Code Generator
  • See all tools→

Pranks

  • Fake Blue Screen Prank
  • Hacker Typer
  • Fake iMessage Generator
  • Windows XP Crash Prank
  • Windows 11 Update Prank
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?