Today, we will walk you through how to insert and eject CD-ROM / DVD-ROM through command line in linux system. Yes! this is also true that you do not have to touch CD/DVD ROM eject switch.

Basically eject command allows removable media to be ejected under software control. Here, software control is your operating system and removable media it is referring to DVD-ROM, CD-ROM, floppy disk, tape, or JAZ or ZIP disk.

By default eject command ejects the CD-ROM or DVD-ROM. Corresponding to name we can also eject that particular device. The name can be a device file or mount point, either a full path or with the leading “/dev”, “/media” or “/mnt” omitted

To eject the DVD-ROM and CD-ROM tray use the given below command.

eject -r

To put back the DVD-ROM and CD-ROM tray,use given below command.
Note: Putting back of DVD-ROM and CD-ROM tray depends upon its types.It mostly works with Desktop’s DVD-ROM or CD-ROM

eject -t

Examples: Eject removable media

Here some of the examples we have written here for some removable device.

1. Don’t eject, just show device found

eject -n

2. Eject DVD-ROM or CDROM

eject -r
## OR  
eject /dev/cdrom

3. Eject SCSI device

eject -s

4. Eject floppy

eject  -f

5. Eject hardware tape or backup tap drive.

eject -q

6. Eject 4th IDE device

eject hdd

7. Eject first SCSI device

eject sda

Important Note: In case when you only use the command –

.
eject

Actually by default it tries -r, -s, -f, and -q in order until get success.
Hence, when you only hit the command eject mostly DVD-ROM/CD-ROM opens the tray because in order -r is first which represent to CD-ROM.

Read Some More Articles

5 Comments

  1. Hi, apart from eject command to eject the dvd drive, is there any possible way to insert the dvd drive tray into the hardware? I mean opposite of eject 🙂

      1. Sharad
        I understand to use eject command to eject.
        But my question is to “insert” the cdrom-tray back into the server, can be done by any command instead of manually pushing the tray? 🙂

        1. Hello Yashin,

          The answer is eject -t, we have mentioned in our Post. But now a days the Modern CD/DVD ROM need physical force to push back the tray so it will not work for example in Laptop’s CD/DVD ROM.

          Regards
          Sharad

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.