How to eject CD using the terminal?
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.
Related videos on Youtube
![TellMeWhy](https://i.stack.imgur.com/JfokC.jpg?s=256&g=1)
Comments
-
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 almost 9 yearsTried
eject
? -
muru almost 9 yearsOf course. What of it?
-
TellMeWhy almost 9 years@muru so, how would I do so?
-
muru almost 9 yearsIf 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 almost 9 years@muru ahh ok, I didn't realise it was a link... :)
-
Gophyr almost 9 yearsand then after you eject it (if it can pull itself back in) you can use
eject -t
...
-
-
kos almost 9 yearsAnd to close it (if the drive supports it),
eject -t