Saturday, November 8, 2008

How to open and close the CD DVD tray

You can open/close the CD, DVD disk tray from the command line.

Many Linux users already know about the eject command for opening the disk tray:
 $ eject

How do you close the tray?

Turns out that you can use the same eject command but with an additional -t option to close the tray.

$ eject -t 

Before I found out about the -t option, I always had to reach and press the open/close button on the drive to close the tray. With the -t option, you can now both open and close the tray from the command line.

There is another option -T (CAPITAL T, that is) you should know.

eject -T
basically closes the tray if it is open, and opens the tray if it is closed.

The man page for eject has detailed explanation about the options.

1 comment:

Alex said...

for x in 1 2 3 4 5
eject -T
sleep 20

is a totally awesome office prank...