Quick tip: Eject and Insert CD / DVD media under Linux

Posted on in Categories Hardware, Linux, Linux desktop last updated October 10, 2007

Eject command allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ or ZIP disk) to be ejected under software control. The command can also control some multi-disc CD-ROM changers, the auto-eject feature supported by some devices, and close the disc tray of some CD-ROM drives.

Eject using device name (DVD/CD)

eject /dev/dvd
eject cdrom
eject /mnt/dvd

Close tray:

eject -t /dev/dvd

Eject first SCSI device:

eject sda

Select CD slot

The command can also control some multi-disc CD-ROM changers (note that the first slot of the changer is referred to as 0, not 1):
eject -c 1 /dev/cdrom

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Leave a Comment