eject
Quick Reference
Command Name:
eject
Category:
system management
Platform:
Linux
Basic Usage:
Common Use Cases
- 1
Media removal
Safely eject CD/DVD discs from optical drives
- 2
USB device unmounting
Safely remove USB storage devices to prevent data loss
- 3
Tray control
Open or close CD/DVD drive trays programmatically
- 4
Device management
Manage removable media in headless or server environments
Syntax
eject [options] [device]
Options
Option | Description |
---|---|
-d |
Display default device name |
-a on|off|1|0 |
Enable/disable auto-eject mode |
-c slot |
Select CD-ROM slot to use |
-h |
Display help information |
-n |
Don't eject, just show device name |
-p |
Full device name with the /dev/ prefix |
-r |
Eject media and close the tray |
-t |
Close the tray |
-T |
Toggle tray state (open/close) |
-v |
Enable verbose output |
-x |
Eject media from an XA-capable CD-ROM drive |
Examples
How to Use These Examples
The examples below show common ways to use the eject
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.