Files
cheatsheet-tldr/tldr/linux/losetup
2025-03-29 00:18:23 +00:00

34 lines
759 B
Plaintext

---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# losetup
> Set up and control loop devices.
> More information: <https://manned.org/losetup>.
- List loop devices with detailed info:
`losetup {{[-a|--all]}}`
- Attach a file to a given loop device:
`sudo losetup {{/dev/loop}} /{{path/to/file}}`
- Attach a file to a new free loop device and scan the device for partitions:
`sudo losetup --show {{[-P|--partscan]}} {{[-f|--find]}} /{{path/to/file}}`
- Attach a file to a read-only loop device:
`sudo losetup {{[-r|--read-only]}} {{/dev/loop}} /{{path/to/file}}`
- Detach all loop devices:
`sudo losetup {{[-D|--detach-all]}}`
- Detach a given loop device:
`sudo losetup {{[-d|--detach]}} {{/dev/loop}}`