Q) Which command will list only sub – directories ?
Ans - $ ls –ld<Enter – Key>
Some Special Listings: -
Q) How to list the sub – directories which has 3 characters
in first three letter and then p ?
Ans - $ ls ???p<Enter – Key>
Q) How to long list the sub – directories which has any one
vowel in first letter , then one character and then anything ?
Ans - $ ls –l [aeiouAEIOU]?*<Enter – Key>
Q) How to list the sub – directories which has ‘h’ in first
letter, then a character in 2nd letter, and then ‘ran’ ?
Ans - $ ls h?ran<Enter – Key>
Q) How to list the sub – directories which have 5 characters
where as 1st character may be from ‘a’ to ‘k’, 2nd
character may be from ‘d’ to ‘s’, 3rd character may be a number from
‘0’ to ‘9’ and then two valid characters ?
Ans - $ ls [a-k][d-s][0-9]??<Enter – Key>
Permission and its change: -
Q) What is the base permission of file and directory ?
Ans – Base permission of file – 666 and directory – 777.
Q) What is umask and its default value ?
Ans – Unmask is the value which determine the default file
or directory permission during its creation.
Its default value is 022.
Q) What is the default permission of file and directory ?
Ans – Default permission of file is 644 and directory is
755.
Q) Which command is use to change the permission of file or
directory ?
Ans – chmod
Where chmod -> change mode
Q) What is absolute and relative permission ?
Ans – Absolute permission is related to numerical value.
Read – 4
Write – 2
Execute – 1
Relative Permission is related to symbolic value.
Read – r
Write – w
Execute – x
i.e. owner has read, write and execute
permission(rwx)(4+2+1).
Group has read and execute permission(r-x)(4+0+1).
Others has execute permission on the same
directory(--x)(0+0+1).
Then the absolute permission will be 751.
Then the relative permission will be rwxr-x—x.
Q) Write a command to change the permission of a file f.txt
to a new permission 611 ?
Ans - $ chmod 611 f.txt<Enter – Key>
Q) Write a command to change the permission of a directory
d1 to a new permission 742 ?
Ans - $ chmod 742 d1<Enter – Key>
Q) Write a command to give owner/user and other read and
execute permission for a file f12.dat ?
Ans - $ chmod uo+rx f12.dat<Enter – Key>
Q) Write a command to take back execute permission from
group and other and give read permission to other for a directory d1 ?
Ans - $ chmod go-x,o+r d1<Enter – Key>
Q) Write a command which replaces all existing permission
for a file file.csv to read write for all ?
Ans - $ chmod ugo=rw file.csv<Enter – Key>
Q) Write a command to give read permission to all for a
directory d3 ?
Ans - $ chmod +r d3<Enter – Key>
Q) Write a command which replaces all permission of group
and other to read and user to read and write for a directory d456 ?
Ans - $ chmod go=r,u=rw d456<Enter – Key>
No comments:
Post a Comment