我刚刚在Unity启动器中右键点击了DVD图标,想要弹出它,但是我错过了'弹出'按钮,而是误触了'从启动台解锁'选项。
现在启动器选项消失了,我该如何弹出光盘驱动器中的光盘呢?
现在启动器选项消失了,我该如何弹出光盘驱动器中的光盘呢?
打开CD驱动器/弹出CD:
eject
eject -t
eject -T
所有这些命令都可以在运行对话框中输入(Alt+F2)
要获取更多选项,请在终端中输入 eject -h
。
命令:
eject
eject -t
alias opentray='eject'
弹出驱动器时可能会遇到一些问题。有时候它们不想弹出,因为它们被挂载了等等。你可以使用eject -l /media/mountpoint
或者/mnt/mountpoint
来覆盖这个问题。我写了一个函数,只需在命令行上输入opentray
即可调用。
此方法仅在以下情况下有效:
/dev/sr0
(与符号链接到 /dev/sr0
的 /dev/cdrom
是同一个东西)设置一个永久挂载点function opentray ()
{
mountdir="/media/DVD"
if [ -d "${mountdir}" ] # If directory ${mountdir} exists
then
if [ $(mount | grep -c "${mountdir}") = 1 ] # If drive is mounted, then
then
echo "/dev/sr0 is now mounted to ${mountdir}. I'll try to unmount it first and eject/open the tray."
umount -l "${mountdir}"
rm -r "${mountdir}"
sysctl -w dev.cdrom.autoclose=0 # Ensure drive doesn't auto pull tray back in.
eject
exit
else
echo "/dev/sr0 is not mounted. Opening the tray should be easy. Ejecting/opening now."
rm -r "${mountdir}"
sysctl -w dev.cdrom.autoclose=0 # Ensure drive doesn't auto pull tray back in.
eject
exit
fi
else
echo 'The directory "${mountdir}" does not exist. Ejecting/opening the tray.'
sysctl -w dev.cdrom.autoclose=0 # Ensure drive doesn't auto pull tray back in.
eject
exit
fi
}
为了完整性,您可以将此别名添加到您的.bashrc
(或.bash_aliases
文件)中,以便从命令行中收回托盘。您不需要使用root权限。
alias closetray='eject -t'
/dev
设备并运行明确的命令。如果您有一个外部USB驱动器,那么一个很好的选择是:
eject /dev/sr0
eject -m
eject
eject --force
eject --force
→ eject: 未识别的选项 '--force'
- kareleject -F
- Alberto Salvia Novella--force
对我无效,但是 eject -v /dev/sr0
提供了有用的信息。(或者 eject -h
) - Paul
sudo
权限。 - Sopalajo de Arrierezeject
在我使用时起作用,然后突然停止工作,并显示以下错误信息:"eject: /dev/cdrom: not found mountpoint or device with the given name"。在执行eject /dev/sr0
后,我又可以正常使用eject
、eject -T
等命令了。 - Victoria Stuart