Windows
About attrib
Attrib allows a user to change the properties of a specified file. Using attrib, the user has the capability of changing the file to have any of the below attributes.
Read-only – allowing the file to be only viewed and not written to.
Archived – allowing Microsoft backup and other backup programs to know what files to backup.
Hidden – making the file invisible to standard users.
System – making the file an important system file.
Syntax :
Microsoft Windows 95, 98, and ME syntax
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [[drive:][path]filename] [/S]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes files in all directories in the specified path.
Microsoft Windows 2000 and Windows XP syntax
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path] filename] [/S [/D]]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes files in all directories in the specified path.
/D Process folders as well.
Microsoft Windows 2000 and Windows XP recovery console syntax
Note: The below options are the available options in the Windows recovery console.
Changes attributes on one file or directory.
ATTRIB -R | +R | -S | +S | -H | +H | -C | +C filename
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
S System file attribute.
H Hidden file attribute.
C Compressed file attribute.
Examples :
attrib
Typing attrib by itself will display all files in the current directory and each of their attributes. If any file is hidden it will also display those files.
attrib +r autoexec.bat
Add the read-only attribute to the autoexec.bat file so it cannot be modified until the read only attribute is taken off. This is helpful for important system files or any other file that you do not want to have mistakenly edited or changed by another program.
attrib +h config.sys
Add the hidden attribute to the config.sys file causing it to be not be seen by the average user.
attrib -h config.sys
This command will do the opposite of the above command. Instead of hiding the file it will unhide the file if hidden.
Example :
Question:
How can I see hidden files in MS-DOS?
Answer:
While in the MS-DOS or the Windows command line navigate to the directory you wish to view hidden files in and type one of the below commands.
attrib
Typing the attrib command alone will display all files in the current directory with their attributes to the left of the directory path and file name. Files that have an “H” to the left are hidden files.
attrib | more
If there are too many files to list on one page adding “| more” to the end of the attrib command will display all files with attributes one page at a time.
attrib *.log
Finally, if you know the name of the file you’re looking for or what it contains adding it with or without wild characters will display all files with their attributes. For example, the above command would list any log file (including hidden files) with its attributes.
Unix File Permissions
The permission description can be in the form of a number that is exactly three digits. Each digit of this number is a code for the permissions level of three types of people that might access this file:
-
Owner (you)
-
Group (a group of other users that you set up)
-
World (anyone else browsing around on the file system)
The value of each digit is set according to what rights each of the types of people listed above have to manipulate that file.
Permissions are set according to numbers. Read is 4. Write is 2. Execute is 1. The sums of these numbers give combinations of these permissions:
-
0 = no permissions whatsoever; this person cannot read, write, or execute the file
-
1 = execute only
-
2 = write only
-
3 = write and execute (1+2)
-
4 = read only
-
5 = read and execute (4+1)
-
6 = read and write (4+2)
-
7 = read and write and execute (4+2+1)
Permissions are given using these digits in a sequence of three: one for owner, one for group, one for world.
- Follow us on Twitter, or subscribe to the rizqtech RSS Feed for more daily web development and articles.
Enjoy this Post!

