How to eject CD using the terminal?

8,732

The eject command does what you want. Without any arguments provided, it ejects the default (first) 'cdrom' device. If you want to eject a specific device, provide it as an argument.

eject /dev/cdrom1

Quoting from the eject manpage (man eject):

Eject 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.
The device corresponding to is ejected. The name can be a device file or mount point, either a full path or with the leading "/dev", "/media" or "/mnt" omitted. If no name is specified, the default name "cdrom" is used.

Share:
8,732

Related videos on Youtube

TellMeWhy
Author by

TellMeWhy

I Wonder

Updated on September 18, 2022

Comments

  • TellMeWhy
    TellMeWhy almost 2 years

    I recently found a question on superuser regarding ejecting a CD using the Windows command line.

    How can I do this using Linux terminal?

    • muru
      muru almost 9 years
      Tried eject?
    • muru
      muru almost 9 years
      Of course. What of it?
    • TellMeWhy
      TellMeWhy almost 9 years
      @muru so, how would I do so?
    • muru
      muru almost 9 years
      If you could take a few minutes to read the manpage I linked to, you'd see: " The device corresponding to <name> is ejected. The name can be a device file or mount point, either a full path or with the leading "/dev", "/media" or "/mnt" omitted. If no name is specified, the default name "cdrom" is used."
    • TellMeWhy
      TellMeWhy almost 9 years
      @muru ahh ok, I didn't realise it was a link... :)
    • Gophyr
      Gophyr almost 9 years
      and then after you eject it (if it can pull itself back in) you can use eject -t...
  • kos
    kos almost 9 years
    And to close it (if the drive supports it), eject -t