umount
檔案與目錄
用法
sudo umount [mountpoint]把已掛載的檔案系統卸下;命令名裡沒有 n,只要還有行程在裡面開著檔案或把工作目錄留在其中,它就會回報 device is busy。
常用選項
| 選項 | 含義 |
|---|---|
| -l | Linux: detach lazily, as soon as nothing is using it |
| -f | Force, which is what an unreachable network share needs |
| -R | Linux: unmount everything below a path |
| -a | Unmount everything listed in /etc/fstab |
範例
sudo umount /mntDetaches the filesystem.
sudo umount -l /mntDetaches as soon as the last user is done (Linux).
lsof +D /mntFinds what is holding it when it says target is busy.
搬移、刪除和尋找。有些命令不會再問一次,所以順手加 -i 是在救自己。
怎麼看
- 方括號 [ ] 表示這部分可以不寫。
- 省略號 … 表示可以寫多個。
- 選項區分大小寫——有些命令裡 -r 和 -R 不是一回事。
常見問題
Q. umount 是做什麼的?
把已掛載的檔案系統卸下;命令名裡沒有 n,只要還有行程在裡面開著檔案或把工作目錄留在其中,它就會回報 device is busy。
Q. 怎麼寫?
sudo umount [mountpoint] —— 方括號表示可以省略的部分。
Q. 值得記的選項有幾個?
這裡列了 4 個,完整列表在 man umount。這條命令屬於檔案與目錄。
相關命令
man 手冊: man umount