By: Strauss K in macos Tutorials on 2011-02-03
chflags command in Mac OS X is used to change the file or directory flags. File flags are the attributes that can be set on a file or directory to modify its behavior or state. The
chflags command can be used to set or unset the file flags.
The syntax of the
chflags command is as follows:
chflags [ -R [-H | -L | -P]] flags file...
Here, the options are:
-R: Recursively change the flags of all files and directories in the specified directory hierarchy.
-H: If a command-line argument is a symbolic link to a directory, recursively change the flags of the directory the symbolic link refers to.
-L: If a command-line argument is a symbolic link, change the flags of the symbolic link itself rather than the file or directory it refers to.
-P: Do not follow symbolic links; instead, change the flags of the symbolic link itself.
The flags are a series of one or more letters, which represent the file or directory flags. Some commonly used flags are:
arch: Set the archived flag.
hidden: Set the hidden flag.
nohidden: Unset the hidden flag.
sappnd: Set the system append-only flag.
noappnd: Unset the system append-only flag.
uchg: Set the user immutable flag.
nouchg: Unset the user immutable flag.
hidden: Set the hidden flag.
Here are some examples of how to use the
Set the hidden flag on a file:
chflags hidden myfile.txt
Unset the hidden flag on a file:
chflags nohidden myfile.txt
Set the immutable flag on a file:
chflags uchg myfile.txt
Unset the immutable flag on a file:
chflags nouchg myfile.txt
Recursively set the hidden flag on all files in a directory
chflags -R hidden mydirectory
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in macos )
Latest Articles (in macos)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews