有没有办法从命令行弹出所有外部硬盘驱动器? (OS X) [英] is there a way to eject all external hard drives from the command line? (OS X)
问题描述
是否可以从命令行弹出OS X计算机上所有已安装的硬盘驱动器卷?如果我可以将其包装在Shell脚本中,则Applescript可以.
Is there a way to eject all the mounted hard drive volumes on an OS X computer from the command line? Applescript is OK if I can wrap that in a shell script.
推荐答案
在终端中尝试:
-
umount -a
(已卸载通过getfsent(3)描述的所有文件系统.) -
umount -A
(当前所有已安装的文件系统,但未卸载根).
umount -a
(All the filesystems described via getfsent(3) are unmounted.)umount -A
(All the currently mounted filesystems except the root unmounted.)
有关更多信息,请参见man umount
.
Fore more information see man umount
.
似乎您也可以使用此功能:
Seems like you can also use this:
diskutil unmountDisk /dev/disk*
虽然没有测试.如果它不起作用,请尝试使用"unmount"代替"unmountDisk".
Didn't test it, though. If it doesn't work, try to use "unmount" instead of "unmountDisk".
哦,我还找到了eject
参数(而不是unmountDisk
).这可能也很有趣.
Oh, I also found the eject
argument (instead of unmountDisk
). That might also be of interest.
diskutil eject /dev/*
似乎是您想要的东西(请参阅评论).
diskutil eject /dev/*
seems what you are looking for (see comments).
这篇关于有没有办法从命令行弹出所有外部硬盘驱动器? (OS X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!