eject Command Examples in Linux

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
Related Post