Saturday, May 7, 2022

Interview Questions: - (UNIX - 0)

UNIX: -

 

Q) How to get inode number of a file/directory?

Ans – $ ls –i <File/Directory_Name>

 

Q) What is inode?

Ans – inode number is unique identifier given to a file or directory inside a file system.

 

Q) What happens to inode when file is deleted?

Ans - When a file or directory is "deleted" its inode number is removed from the directory which contains the file.

 

Q) What action you will take if inode get filled?

Ans – If all inodes in a file system are completely filled, the unix system cannot create new files even when there is available space on the disk.

inode is full that means unix system have so many files which might be unnecessary. So just we have to find out those unnecessary files and delete them or  we have to find out hard links and removed it.

 

Q) How to find which Unix Operating system you are using?

Ans –$ uname –a

 

Q)  How to change group name of file/directory in unix?

Ans –  $ chgrp <group_name> <file/directory_name>

 

Q) How to change owner name of file or directory in unix?

Ans –  $ chown <owner_name> <file/directory_name>

 

Q) What is link and types of links and explain?

Ans –

 link is a pointer to an original file. It is of two types.

1.       Soft Link (Symbolic Link)

2.       Hard Link

SOFT LINK -

 It has below characteristics.

1.       It creates copy of original file.

2.       Both link file and original file have different inode number.

3.       Once original file is deleted, its corresponding soft link file is unusable.

4.       We can create soft link throughout the file system for the original file.

5.       You can create soft link to a directory.

Syntax: -

$ ln –s <Original File Name> <Soft Link File Name>

Example –

$ ln –s Sample.txt Sample.link

HARD LINK –

 It has below characteristics.

1.       It points to the inode number of the original file.

2.       Both link file and original file have same inode number.

3.       We can access the content of the link file as same as original file, once original file is deleted i.e. it is the backup of the original file.

4.       We can create hard link only within the file system, where original file is present.

5.       You cannot create hard link to a directory.

Syntax: -

$ ln <Original File Name> <Hard Link File Name>

Example –

$ ln Sample.txt Sample.link

No comments:

Post a Comment

Interview Questions: - (UNIX - 0) UNIX: -   Q) How to get inode number of a file/directory? Ans – $ ls –i <File/Directory_Name...