Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想通过 bash 脚本或终端从 ubuntu os 卸载所有笔式驱动器。我知道命令 umount /media/MEDIA_NAME,但是这里我们需要指定每个 MEDIA_NAME。我可以使用单个命令从终端或 bash 脚本中卸载吗?请帮我。
浏览 /dev/disk/by-id/ 中的条目允许您选择 USB 磁盘:
for usb_dev in /dev/disk/by-id/usb-*; do dev=$(readlink -f $usb_dev) grep -q ^$dev /proc/mounts && umount $dev done
为 /media 目录中的每个设备循环。
for device in /media/* do umount $device done