CHFLAGS(1)

πŸ“¦
version 479 Β· 3 versions
, in nixpkgs unstable

πŸ’… CHFLAGS(1) β€” the chflags glow-up (General Commands Manual)

okay so bestie, welcome to chflags β€” the little utility that changes the file flags of your files, fr fr. like, you hand it a flags operand and a list of file ... and it just goes and does the thing. slay ✨


✨ SYNOPSIS ✨

chflags [-fhvx] [-R [-H | -L | -P]] flags file ...

πŸ¦‹ DESCRIPTION πŸ¦‹

The chflags utility modifies the file flags of the listed files as specified by the flags operand. that's it, that's the whole vibe πŸ’…

The options are as follows β€” buckle up, there's a bunch:

  • -f β€” do not display a diagnostic message if chflags could not modify the flags for file, and do not modify the exit status to reflect such failures. like, it just moves on, no drama πŸ™ˆ
  • -H β€” if the -R option is specified, symbolic links on the command line are followed and hence unaffected by the command. (symbolic links encountered during traversal are not followed.) iykyk πŸŽ€
  • -h β€” if the file is a symbolic link, change the file flags of the link itself rather than the file to which it points. main character energy for the link πŸ”—
  • -L β€” if the -R option is specified, all symbolic links are followed. all of them. periodt ✨
  • -P β€” if the -R option is specified, no symbolic links are followed. this is the default. lowkey the chill one 🌸
  • -R β€” change the file flags of the file hierarchies rooted in the files, instead of just the files themselves. beware of unintentionally matching the β€œ..” hard link to the parent directory when using wildcards like β€œ.*”. 🫢 this one will vibe-check you back, ngl
  • -v β€” cause chflags to be verbose, showing filenames as the flags are modified. if the -v option is specified more than once, the old and new flags of the file will also be printed, in octal notation. double -v = extra detail, we love to see it πŸ”₯
  • -x β€” do not cross mount points. stay in your lane, bestie 🚧

🧚 the flags themselves (the fun part) 🧚

The flags are specified as an octal number or a comma separated list of keywords. the following keywords are currently defined:

  • arch, archived β€” set the archived flag (super-user only) πŸ‘‘
  • nodump β€” set the nodump flag (owner or super-user only)
  • opaque β€” set the opaque flag (owner or super-user only) [directory is opaque when viewed through a union mount]
  • sappnd, sappend β€” set the system append-only flag (super-user only) πŸ‘‘
  • schg, schange, simmutable β€” set the system immutable flag (super-user only) πŸ‘‘
  • uappnd, uappend β€” set the user append-only flag (owner or super-user only)
  • uchg, uchange, uimmutable β€” set the user immutable flag (owner or super-user only)
  • hidden β€” set the hidden flag [hide item from GUI] 🫣

🌈 the "no" trick 🌈

Putting the letters β€œno” before a keyword β€” or removing the letters β€œno” from a keyword β€” causes the flag to be cleared. for example:

  • nouchg β€” clear the user immutable flag (owner or super-user only)
  • dump β€” clear the nodump flag (owner or super-user only)

literally the same word, opposite vibes. πŸ’€


⚠️ important caveats, pls read ⚠️

Unless the -H or -L options are given, chflags on a symbolic link always succeeds and has no effect. πŸ’€ like, it does nothing but it's not a fail. iconic but useless.

The -H, -L and -P options are ignored unless the -R option is specified. also, these options override each other and the command's actions are determined by the last one specified. so the last one wins, always β€” no tiebreakers πŸŽ€

You can use "ls -lO" to see the flags of existing files. ⭐

If chflags receives a SIGINFO signal (see the status argument for stty(1)), then the current filename as well as the old and new flags are displayed. cute lil progress update πŸ¦‹


🌸 EXIT STATUS 🌸

The chflags utility exits 0 on success, and >0 if an error occurs. simple as that 🫢


✨ EXAMPLES ✨

Recursively clear all flags on files and directories contained within the foobar directory hierarchy:

chflags -R 0 foobar

the 0 is doing so much work here and nobody's talking about it πŸ’…


πŸŽ€ SEE ALSO πŸŽ€

ls(1), chflags(2), stat(2), fts(3), symlink(7)

go read them, bestie, they're all part of the lore πŸ“š


πŸ¦‹ HISTORY πŸ¦‹

The chflags command first appeared in 4.4BSD. an icon, a legend, a pioneer πŸ‘‘


πŸ’€ BUGS πŸ’€

Only a limited number of utilities are chflags aware. some of these tools include ls(1), cp(1), find(1), install(1), dump(8), and restore(8). in particular, a tool which is not currently chflags aware is the pax(1) utility. 😭 so if pax ignores your flags, that's not you, that's pax.


okay that's the whole page, bestie β€” this manual page came to you from Debian, dated June 12, 2018. go forth and flag responsibly πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from
  • nixpkgs unstable: file_cmds 479
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms