• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

eject Command Examples in Linux

by admin

eject Command ejects removable media such as a CD, DVD, floppy, or tape. You may name the device by its /dev or /mnt filename. The /dev and /mnt prefixes are optional for any items in the /dev and /mnt directories. If no device is named, it is assumed that “cdrom” should be ejected.

Syntax:

eject [options] [device]
Note: Only devices that support eject under program control respond to this command.

eject Command Examples

1. To eject the default removable device:

# eject

2. To eject a cdrom:

# eject cdrom
# eject /dev/cdrom

3. To eject removable media using mount point:

# eject /mnt/cdrom

4. To eject the disk device:

# eject hdd
# eject sda
# eject sda4

5. To display the message when ejecting:

# eject -h cdrom

6. To run eject in verbose mode:

# eject -v cdrom

7. To list the default device name:

# eject -d cdrom

8. To control the auto-eject device:

# eject -a on cdrom
# eject -a 1 cdrom
# eject -a off cdrom
# eject -a 0 cdrom 

9. To select the cd slot from multi device:

# eject -c 2 cdrom

10. To control locking of the hardware eject button:

# eject -i on cdrom 
# eject -i 1 cdrom 
# eject -i off cdrom 
# eject -i 0 cdrom

11. To give a close CD-ROM tray also:

# eject -t cdrom

12. To give the drive is given a CD-ROM tray close command if itâs opened:

# eject -T cdrom

13. To give the speed:

# eject -x 8x

14. To detect the cd drive speed:

# eject -X cdrom

15. To display the selected device:

# eject -n cdrom

16. To specify that the drive should be ejected using cdrom eject command:

# eject -r cdrom

17. To specify that the drive should be ejected using SCSI eject command:

# eject -s sda

18. To specify that the drive should be ejected using floppy disk eject command:

# eject -f fd0

19. To specify that the drive should be ejected using tape drive offline eject command:

# eject -t cdrom

20. To allow you to use /proc/mounts instead /etc/mtab

# eject -p cdrom

21. To allows eject to work with device drivers which automatically mount removable media:

# eject -m usb

22. To display the program version:

# eject -V

Filed Under: Linux

Some more articles you might also be interested in …

  1. hwclock: command not found
  2. ipcalc Command Examples in Linux
  3. ntpdate Command Examples in Linux
  4. flips: Create and apply patches for IPS and BPS files
  5. nice: command not found
  6. latex Command Examples
  7. mingle Command Examples
  8. mke2fs Command Examples in Linux
  9. certbot: command not found
  10. “az tag” Command Examples (Manage tags on a resource)

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright