chflags in Mac OS X

By: Strauss K Emailed: 1768 times Printed: 2515 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Change a file or folder's flags.

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

Options
   -R      Recurse: Change the file flags of file hierarchies rooted in the files
           instead of just the files themselves.

   -R -H   Follow symbolic links on the command line
          (by default Symbolic links within the tree are not followed.)	       

   -R -L   All symbolic links are followed.

   -R -P   No symbolic links are followed. (default)

The flags are specified as an octal number or a comma separated list of keywords.

             hidden           set the hidden flag [Hide item from GUI]

Keywords and keyword aliases - Owner or Super-user only:

             opaque           set the opaque flag 
             nodump           set the nodump flag 
             uappnd, uappend  set the user append-only flag
   uchg, uchange, uimmutable  set the user immutable flag
             uunlnk, uunlink  set the user undeletable flag

Keywords and keyword aliases - Ssuper-user only:

             arch, archived   set the archived flag
             sappnd, sappend  set the system append-only flag
   schg, schange, simmutable  set the system immutable flag
             sunlnk, sunlink  set the system undeletable flag

The immutable flag is equivalent to locking the file in the Finder's Show Info box.

Putting the letters `no' before an option causes the flag to be turned off.

  For example:
	   nouchg  means the file can be changed (immutable bit cleared)
	   uchg    means the file cannot be changed

Symbolic links do not have flags, so unless the -H or -L option is set, chflags on a symbolic link always succeeds and has no effect. The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options override each other and the command's actions are
determined by the last one specified.

The sappnd and schg flags may only be unset when the system is in single-user mode. chflags(2).

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

The return status is zero if the mode is successfully changed,and >0 if an error occurs.

Examples

Lock the file or folder named "finance" against changes
$ chflags uchg finance

Make the file "MyLogs.txt" append-only
$ chflags uappnd MyLogs.txt

Unlock your Documents directory and everything in it
$ chflags -R nouchg ~/Documents


macos Home | All macos Tutorials | Latest macos Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Strauss K
cut in Mac OS X
curl in Mac OS X
crontab in Mac OS X
cron in Mac OS X
cp in Mac OS X
continue in Mac OS X
complete in Mac OS X
command in Mac OS X
comm in Mac OS X
cmp in Mac OS X
cksum in Mac OS X
chroot in Mac OS X
chown in Mac OS X
chmod in Mac OS X
chgrp in Mac OS X

More Tutorials in macos
Getting PHP running on Mac OS 10.1
Installing gedit for python programming in Mac OS X
What is Mac OS X?
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
awk in Mac OS X
basename in Mac OS X
bash in Mac OS X
bg in Mac OS X
bless in Mac OS X
break in Mac OS X

More Latest News
Most Viewed Articles (in macos )
History of Mac OS X
Different Versions of Mac OS X
awk in Mac OS X
break in Mac OS X
cal, ncal in Mac OS X
crontab in Mac OS X
cut in Mac OS X
What is Mac OS X?
Major features of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
caller in Mac OS X
cd in Mac OS X
chflags in Mac OS X
Most Emailed Articles (in macos)
Installing gedit for python programming in Mac OS X
What is Mac OS X?
apropos in Mac OS X
cal, ncal in Mac OS X
cmp in Mac OS X
crontab in Mac OS X
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
awk in Mac OS X
basename in Mac OS X
bash in Mac OS X
bg in Mac OS X