Eject/Close CD or DVD media with shell command

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

cuckoo clockShell command eject that is available by default in most of Linux distributions, allows to open and sometimes close removable media tray (usually it’s CD-ROM or DVD media).

To eject media:

eject /dev/cdrom

or

eject cdrom

As you see the name of device 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. With -c option a CD slot can be selected from an ATAPI/IDE CD-ROM changer.

To close tray:

eject -t cdrom

Dear reader, I hope you know what use eject command for if you came here, but let me suggest one more application. You can use this command to make your own cuckoo clock! :)

Just put little shell script opening and closing cdrom or dvd tray into cron…

 
 
» You might also be interested in the following articles:
Quick shell change for user in Unix or Linux
Can’t find usable shell script encryption solution…
Comparing Bash with… Windows command line shell…
Try Google Chrome in Linux
Ping range of IP addresses in parallel with fping



» Want to stay up to date? Subscribe to our E-MAIL or RSS feed!


0 Responses to “Eject/Close CD or DVD media with shell command”


  1. No Comments

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word




Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | Linux config Wiki | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››