有没有办法从命令行弹出所有外部硬盘驱动器?(OS X) [英] is there a way to eject all external hard drives from the command line? (OS X)

查看:33
本文介绍了有没有办法从命令行弹出所有外部硬盘驱动器?(OS X)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从命令行弹出 OS X 计算机上所有已安装的硬盘驱动器卷?如果我可以将 Applescript 包装在 shell 脚本中就可以了.

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.

推荐答案

In Terminal try:

In Terminal try:

  • umount -a (所有通过 getfsent(3) 描述的文件系统都被卸载.)
  • umount -A (所有当前挂载的文件系统,除根目录外的所有文件系统都被卸载.)

更多信息参见man umount.

好像你也可以用这个:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆