Linux Interview Questions and Answer
Hiển thị các bài đăng có nhãn Linux Interview Questions and Answer. Hiển thị tất cả bài đăng

Linux file system related questions and answers

1. What is an inode in Linux?

-An inode (index node) is a data structure that stores metadata about a file  such as file size, permissions, ownership, timestamps, and disk block locations — but not the file name or its path.

- Each file has one unique inode, and file names are stored in directory entries that map names to inode numbers.

#ls -i filename (Example command)

Shows the inode number of a file.

2. How can you check disk space usage on a Linux system?

- df -h (You can use this commands)

-Displays disk space usage for all mounted file systems in human-readable form.

du -sh /path/to/dir

- Shows total disk usage of a directory.

- Real-time tip: Use du -h --max-depth=1 to find which directories consume the most space.

3. What happens when a file is deleted in Linux while a process is still using it?

 - The file’s directory entry is removed, but the data remains on disk until the process releases the file descriptor.

- You can identify such files using:

lsof | grep deleted

- If you need to reclaim space