is there a way to eject all external hard drives from the command line? (OS X)

前端 未结 5 683
刺人心
刺人心 2021-02-07 13:41

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.

5条回答
  •  执笔经年
    2021-02-07 14:21

    I found this to work for ejecting all dmg and physical hard drives:

    find /dev -name "disk[1-9]" -exec diskutil eject {} \;
    

提交回复
热议问题