chdosattr(1)

πŸ’… chdosattr β€” change DOS file attributes πŸ’…

straight outta the General Commands Manual, section 1, it's ya girl chdosattr πŸŽ€


🌸 NAME 🌸

chdosattr β€” change DOS file attributes. that's it, that's the whole job, and she does it flawlessly πŸ’β€β™€οΈ


✨ SYNOPSIS ✨

chdosattr [ -RVH ] ATTR FILES...

πŸ¦‹ DESCRIPTION πŸ¦‹

bestie. listen. your files have little DOS moods attached to them and chdosattr is the one who gets to rearrange them. here's the roster:

  • r (READONLY)
  • h (HIDDEN)
  • s (SYSTEM)
  • a (ARCHIVED)

now, the ATTR you hand her comes in two parts, and the format is literally this: [+-=][ahrs] β€” first part is the operator spec, second part is the DOS attributes. no cap. 🫢

so what do the operators do? glad you asked:

  • + β€” adds the DOS attributes you named to the existing DOS attribute set 🫢
  • - β€” removes them πŸ’€
  • = β€” adds the ones you named and removes every unmentioned DOS attribute. it's giving total makeover. πŸ”₯

and if you're too cool to type an operator at all? the operator part is omitted and = is assumed. iconic default behaviour, we love a self-sufficient queen. πŸ‘‘


🌈 OPTIONS 🌈

  • -R β€” change files and directories recursively. go deeper. πŸŒ€
  • -V β€” show version. πŸ‘€
  • -H β€” show help. πŸ™‹β€β™€οΈ

πŸ’œ EXIT STATUS πŸ’œ

  • 0 β€” on success. we ate and left no crumbs ✨
  • 1 β€” when no file could modified 😭
  • 2 β€” on usage error πŸ™ˆ
  • 3 β€” when an error occurred but at least one file has been successfully modified. it's messy but she pulled through πŸ’…

πŸ’€ BUGS AND LIMITATIONS πŸ’€

heads up bestie, this part is real: modifying the DOS attribute s(SYSTEM) requires CAP_LINUX_IMMUTABLE β€” see capabilities(7). no permission, no system attribute, periodt.

and for obvious reasons, the DOS attributes s(DIRECTORY) and v(VOLUME) cannot be altered. they're booked and busy elsewhere. 🚫


πŸ“ NOTE πŸ“

in vFAT, exFAT and NTFS, only the READONLY attribute is controlled through the owner write permission bit. meanwhile the Linux kernel is always out here setting ARCHIVE on files it creates and modifies β€” main character energy, honestly. 🌟

HIDDEN and SYSTEM can only be controlled through ioctl_fat(2). and guess what β€” lsdosattr(1) and chdosattr(1) are the wrappers for the ioctl. iykyk 🧚


πŸ‘‘ SEE ALSO πŸ‘‘

chmod(1), chattr(1), ioctl_fat(2) and the documentation on ATTRIB command in Microsoft Windows and various DOS. go read, bestie, it's a whole rabbit hole πŸ‡πŸ’–


and that's the whole page!! this was chdosattr from the General Commands Manual, section 1 β€” mwah, sending you the biggest kiss, stay slaying πŸ’‹βœ¨ πŸŽ€ πŸ¦‹ 🌸 πŸ’… 🫢

πŸ“¦ where this page comes from