Saturday, 8 September 2012

UNIX basic commands 1


Unix Commands


Question 1:  To go to a path or directory in Unix
Answer:  a) –bash -3.2$ cd ..   [ to come to one level up]
                     –bash -3.2$cd ../..   [ to come to two level up ]
                     –bash -3.2$cd /  [ to come to root directory ]
                     –bash -3.2$cd ../..   [ to come to two level up ]

Note : here bash is the shell in unix , as far as i know.

Question 2: What is the meaning of first character when you type ‘ls –l’. The output comes like this  crwx - -x-wx
Answer: if the first character is ‘c’ then it means file with special character
             if the first character is ‘d’ then it means file is a directory
            if the first character is ‘-’ then it means file is a plane text file
The following screen shot will make it clear
                                                                              



       

                                                                      
Question 3: Permissions in UNIX.
Answer: if you see the above screen shot , then after the first character ‘c or d or –‘ there are nine characters in the form of rwx-rx—x

 Small ‘r’ stands for read , small ‘w’ stands for write and small ‘x’ stands for execute

The first three characters are for ‘owners/users’ , then next three characters are for ‘Group’ and final three characters are for others. E.g,

               rwxr-xr- -
i) the first three characters rwx represents that the owners have got read,write and execute permissions on the file

ii) the next three characters r-x represents that ‘group’ has got read and execute permission on the file

iii) the final three characters r - - represents ‘others’ have read only permission on the file.
Hope this example makes permission in unix clear.


No comments:

Post a Comment