Everything in Unix is considered to be a file, including physical devices such as USB devices, floppy drives, DVD-ROMs, etc.
Every file or directory is uniquely identified by its name, the directory in which it resides and a unique identifier, usually called an inode.
There are several types of files available in Unix, each file type is different from another and have different purpose to serve.
Symbol |
File Type |
– |
Represent a regular file in Unix/Linux. |
d |
Represent a directory in Unix/Linux. |
l |
Represent a symbolic link. Please note that with symbolic links, the remaining file attributes are always rwxrwxrwx and are dummy values. |
c |
Represent a character special file. This file type refers to a device that handles data as a stream of bytes, such as a terminal or modem. |
s |
Represent a socket special file used for inter process communication. These allow communication between two processes. |
b |
Represent a block special file. This file type refers to a device that handles data in blocks, such as a hard drive or CD-ROM drive. |
Unix File Permissions
For every unix file or directory, mostly there are three kinds of permissions
r – read => Read/view the file
w – write => create, edit or delete
x – execute => run a script/program or enter a directory
There are three levels which defines who can access the file
u – user => owner of the file
g – group => a bunch of people in the same project
o – other => everyone on the system
Let’s take an example of the output of “ls -lt” command to explain the file permission
-rwxr-xr-x 1 root quest 3743 Apr 30 2012 server.sh
Setting up the file permissions
To setup the file permissions we can use “chmod” command, but first we should understand the meaning of different permissions
Symbolic Notation |
Octal Notation |
Meaning |
———- |
0000 |
no permissions |
—x–x–x |
0111 |
execute |
–w–w–w- |
0222 |
write |
–wx-wx-wx |
0333 |
write & execute |
-r–r–r– |
0444 |
read |
-r-xr-xr-x |
0555 |
read & execute |
-rw-rw-rw- |
0666 |
read & write |
-rwxrwxrwx |
0777 |
read, write, & execute |
The number and letter represents :
Read == r == 4
Write == w == 2
Execute == x == 1
You can use chmod command in different ways :
Symbolic Example |
Numeric |
Explanation |
chmod u=rwx,g=rwx,o=rx |
chmod 775 |
For world executables file/directory |
chmod u=rwx,g=rx,o= |
chmod 750 |
For read, executables by group only |
chmod u=rw,g=r,o=r |
chmod 644 |
For world readable file/directory |
chmod u=rw,g=r,o= |
chmod 640 |
For group readable file/directory |
chmod u=rw,go= |
chmod 600 |
For user readable file/directory |
chmod u=rwx,go= |
chmod 700 |
For user executables only |
Examples :
chmod 755 file_name -rwxr-xr-x 1 root quest 3743 Apr 30 2012 file_name
chmod –R 755 directory_name -rwxr-xr-x 1 root quest 3743 Apr 30 2012 directory_name
-R is used to recursively change the content of directory as well
chmod 755 * -rwxr-xr-x 1 root quest 3743 Apr 30 2012 file_name -rwxr-xr-x 1 root quest 3743 Apr 30 2012 file1_name -rwxr-xr-x 1 root quest 3743 Apr 30 2012 file2_name
* denotes everything in current directory
chmod 777 file_name -rwxrwxrwx 1 root quest 3743 Apr 30 2012 file_name
Detailed description about chmod command can be found at wiki
This article is just to explain the Unix File System, We will cover several basic/advanced Unix commands in our next article.
So, till then please be tuned and enjoy reading…
Thanks for this explaination.
Helped me a lot !!
Wow, marvelous blog structure! How long have you been blogging for?
you made running a blog glance easy. The total glance of your site is excellent, let alone the content!
I’m so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that’s at the other blogs. Appreciate your sharing this best doc.
Hey very nice blog!! Guy .. Excellent .. Amazing .. I will bookmark your site. I am satisfied to search out so many useful info right here within the put up, we want work out more techniques in this regard, thank you for sharing. . . . . .
Your means of explaining everything in this paragraph is really good, every one be capable of without difficulty understand it, Thanks a lot.
Thanks for this informative web site.
Super-Duper website! I am loving it!! Will be back later to read some more.
Thank you a bunch for sharing this with all people you actually understand what you’re talking about! Bookmarked.
Generally I don’t learn article on blogs, however I wish to say that this write-up very pressured me to try and do so! Your writing style has been surprised me. Thank you, quite great article.
Very well written article. It will be beneficial to anybody who utilizes it, including me. Keep doing what you are doing – can’r wait to read more posts.
I’m still learning from you, but I’m trying to reach my goals. I certainly liked reading everything that is written on your website.Keep the aarticles coming. I liked it!
Very good article.
Thanks again for the post. Fantastic
This is really interesting, You’re a very skilled blogger. I look forward to seeking more of your fantastic post. Also, I have shared your website in my social networks!
Fantastic!
“Thanks a lot for the post. Much obliged.”
Nice post! Thank you.
Hello very nice site!! Man .. Excellent .. Amazing ..
I will bookmark your site and take the feeds additionally?
I am satisfied to find a lot of useful info
here within the publish, we want develop extra strategies on this
regard, thank you for sharing. . . . . .
Valuable info. Fortunate me I discovered your web site unintentionally,I bookmarked it.
Thanks for sharing, this is a fantastic blog.Really thank you! Keep writing.