The Cluttered Desktop
Ubuntu utilizes the GNOME desktop environment, which includes the Nautilus file manager. When you insert a USB flash drive, an external hard drive, or an SD card into your computer, Ubuntu’s default behavior is to immediately mount the drive and automatically open a new Nautilus window displaying its contents directly on your screen. If you are inserting a drive simply to format it, run a backup script in the terminal, or create a bootable live USB, this automatic popup is an unnecessary interruption that forces you to manually close a window before proceeding with your intended task.
Disabling Media Autorun
To maintain a clean workspace and stop Ubuntu from automatically opening the file manager every time you insert removable media, you must adjust the system’s “Removable Media” preferences.
Click on the system menu in the top-right corner of the Ubuntu top bar and select Settings. In the left-hand navigation sidebar, click on Default Apps (on some older Ubuntu versions, this might be located under ‘Details’ or ‘Removable Media’ directly in the main list). Locate the section specifically dealing with Removable Media. You will see a setting labelled Never prompt or start programs on media insertion. Click the toggle switch or checkbox next to this option to enable it. Alternatively, you can define specific actions for different media types (like CDs or Music Players) by setting their individual dropdown menus to Ask what to do or Do nothing. Ubuntu will now silently mount your USB drives in the background, waiting for you to open them manually.