Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

[Type the document title]

Assignment No.7: Execute file and directory manipulation commands-diff,


comm pr, chmod, mkdir, rmdir, cd, pwd, dir, emp. (Use wild card
character).

1. How to shift from Root directory to User (Home) directory?


Ans:
$cd using cd command without specifying any argument will always shift the terminal to
home directory or the command $cd ~ will do the same job.

2. How to see directories?


Ans:
When can see the directories using $Is –d */ command.

3. What is default set of permissions given by the system to the directory?


Ans:
The default umask value is 0022 which decides the default permission for a new file and
directory the default permission for a directory is 0777.

4. Assign all the permissions to your directory for all the users using symbolic and octal
method.
Ans:
chmod 777/ home => octal method
Where 7 => read, write and execute
(4) + (2) + (1)

5. What is difference between comm and cmp command?


Ans:
i. comm: This command is used to compose two sorted file.
ii. cmp: This command is used to compose two files character by character.

6. Write the command for performing the following tasks sequentially.


a) Display your current directory.
$pwd => display current working directory.

b) Create a directory ‘subject’ in the current directory.


$mkdir subject =. Create directory named subject.

c) Create a file ‘sample’ in the directory ‘subject’.


Subject $touch sample

d) Remove the write permission for the owner for ‘sample’ using symbolic method.
Chmod u__w_sample

7. What are the permissions assigned to the file/files after execution of following commands?
a) $chmod 700 abc
Assign read, write and execute permission to user for file abc.

b) $chmod u+rwx, go-rwx file1 file2


Assign read, write and execute permission to user remove all permission form
group other for file 1 and 2.

1 IF Department
[Type the document title]
c) $chmod 536 xyz
Assign write and execute to user read and execute to group and read and write to
other.

8. Create new files pqr and prql. Perform the commands.


a) $chmod ugo=r pqr
Assign read permission to the user group and other for file pqr.

b) $chmod ugo=r pqrl


Assign the read permission to the user group and other file pqrl.

9. Assign read and write permission for the owner, write permission for the group and
execute permission for others using octal method for file mfile.
Ans:
$chmod 62: mfile
The above command will assign read and write permission to user write permission to
group and execute permission to other.

2 IF Department

You might also like