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, restart the process or truncate the file.
4. How do you check which file systems are mounted?
- mount | column -t
or
- cat /proc/mounts
- Both commands display all currently mounted file systems along with their mount points and options.
5. How to identify which partition a specific file belongs to?
- df /path/to/file
- This command shows the file system (partition) on which the file resides.
6. What is the difference between ext3 and ext4?
- Feature ext3 ext4
- Max file size 2 TB 16 TB
- Journaling Yes Yes (faster, checksums)
- Extents No Yes (reduces fragmentation)
- Performance Moderate Higher
- Delayed allocation No Yes (improves write performance)
7. How do you repair a corrupted file system?
-Unmount the file system:
-umount /dev/sdX#
-Run file system check:
-fsck -y /dev/sdX#
-If fsck finds errors, it will attempt to fix them.
-Caution: Always back up data before running fsck.
8. What’s the difference between hard link and soft link?
Type Command Key Features
Hard link ln file1 file2 Same inode, cannot cross file systems
Soft (symbolic) link ln -s file1 file2 Points to path, can cross file systems
Check link type:
ls -l
Symbolic links show an arrow (→) to the original file.
9. How do you view open files and the processes using them?
lsof | less
To check files opened by a specific user:
lsof -u username
To check files opened on a mount point:
lsof /mount/point
10. How do you find large files consuming space?
find / -type f -size +500M -exec ls -lh {} \;
Finds files larger than 500 MB. Useful for troubleshooting low disk space.
#AWS #Linux #DevOps #Networking