Easily Eject/Close CD-Rom Tray in Ubuntu via Keyboard Shortcut


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:

  1. Open System Settings from the Dash or Unity’s left Launcher.
  2. When it opens, click on Keyboard icon and navigate to Shortcuts tab.
  3. Select “Sound and Media” from the left pane, then you should see the Eject option in the bottom of right pane.
  4. 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.

About ml

ml is a part time stay-at-home dad who've been using Ubuntu Desktop for a few years. He writes in the free time and wishes to share some useful tips with Ubuntu beginners and lovers.