[英]How to find the directory a device is mounted to?
在Linux中,是否可以通过bash脚本获取'/ dev / sr0'并确定它挂载到哪个文件夹并对所述文件夹执行额外操作?
You can use the command mount(8)
to find what device is mounted where. 您可以使用命令
mount(8)
查找安装在哪里的设备。 On Linux this information is found in the /proc/mounts
file. 在Linux上,此信息位于
/proc/mounts
文件中。
You can output the directory name via this command: 您可以通过以下命令输出目录名称:
grep /dev/sr0 /etc/mtab | cut "-d " -f2
or use it in other commands like this (eg list its contents): 或者在其他命令中使用它(例如列出其内容):
ls $(grep /dev/sr0 /etc/mtab | cut "-d " -f2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.