Without pushing the physical eject button, here’s how to easily toggle (eject/close) your CD-Rom tray via keyboard shortcut or hotkey in Ubuntu.
In Ubuntu Linux, we can use eject command to eject CD-Rom tray, eject -t command to close, and eject -T to toggle (if open, close and if closed, open) CD-Rom tray.
For those who hate Linux command, toggle cd-rom tray using a hotkey is easier since Ubuntu provides a reserved Eject option in the keyboard settings utility.
To enable option and assign a keyboard shortcut:
- Open System Settings from the Dash or Unity’s left Launcher.
- When it opens, click on Keyboard icon and navigate to Shortcuts tab.
- Select “Sound and Media” from the left pane, then you should see the Eject option in the bottom of right pane.
- click to highlight it and assign a hotkey by pressing a key combination on your keyboard.
Finally press the shortcut key to eject, or close if device support, the CD-Rom tray.