3 ms·
One non-obvious reason dd is often used in examples is because of device permissions. You can't (easily/legibly) present a one-liner that combines cat and sudo
by tyingq 6y ago
One non-obvious reason dd is often used in examples is because of device permissions.
You can't (easily/legibly) present a one-liner that combines cat and sudo because sudo doesn't give the shell redirection (sudo cat >> /dev/whatever) permissions. But "sudo dd of=/dev/whatever" works fine.
Edit: Yes, you can make a one liner via sh -c, tee, etc, but depending on cut/paste with quotes is tricky, or the one-liner gets long.
- colejohnson66 6y agoYou can also just use `su`, run your command, then `exit`, but you’re right: `sudo dd` is much easier. (This obviously ignores that you should almost never use `su`)
- na85 6y ago> you should almost never use `su` Why?
- colejohnson66 6y agoThe same reason you should be logged in as root. It has its uses, but you need to be careful as it can be easy to forget you’re running as root and screw something up. Explicitly putting `sudo` before every command makes it clear what you’re doing.