48 command-line dvd eject
我刚刚右键单击 Unity Launcher 中的 DVD 图标以将其弹出,但我没有点击“弹出”按钮,而是错过并点击了“从 Launchpad 解锁”选项。
既然缺少 Launcher 选项,我该如何从驱动器中弹出磁盘?
Tim*_*Tim 22
要打开 CD 驱动器/弹出 CD:
ejecteject -teject -T所有这些命令都可以输入到运行对话框 ( Alt+ F2)
如需更多选项,请eject -h在终端中输入。
命令:
ejecteject -talias opentray='eject'
弹出驱动器时会出现一些问题。有时他们不想弹出,因为他们被挂载等。你可以用eject -l /media/mountpoint或 ( /mnt/mountpoint)覆盖它。我写了一个函数,只需opentray在命令行上输入即可调用。
这仅适用于
/dev/sr0(与 相同/dev/cdrom,只是象征性地链接到/dev/sr0)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
}
Run Code Online (Sandbox Code Playgroud)
为了完整起见,您可以将此别名添加到您的.bashrc(或.bash_aliases文件)以从命令行拉回托盘。您不需要是 root。
alias closetray='eject -t'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
163871 次 |
| 最近记录: |