Linux Interview Questions and Answers for 5 years experience
-
What is the difference between hard links and symbolic links?
- Answer: A hard link is a directory entry that points to the same inode as another file. Multiple hard links can exist to the same data. Deleting one hard link doesn't affect the others; the data is only deleted when the last hard link is removed. Symbolic links, or symlinks, are pointers to a file or directory. They are separate files containing the path to the target. Deleting a symlink doesn't affect the target file, and the symlink itself can be broken if the target is moved or deleted.
-
Explain the concept of an inode.
- Answer: An inode (index node) is a data structure in a Unix-like file system that describes a file. It doesn't contain the file's data itself, but metadata such as file permissions, ownership, timestamps (creation, modification, access), file size, and pointers to the data blocks on the disk. Inodes are crucial for file system organization and efficiency.
-
What are the different file system types in Linux and their characteristics?
- Answer: Common Linux file systems include ext4 (highly reliable, journaling), XFS (high performance, large file support), Btrfs (copy-on-write, advanced features like snapshots and RAID), and others like FAT32 (compatibility with Windows), NTFS (Windows file system, read-only by default in many Linux distributions), and tmpfs (memory-based file system). Each has strengths and weaknesses in terms of performance, features, and compatibility.
-
How do you manage users and groups in Linux?
- Answer: User and group management is primarily done using commands like `useradd`, `usermod`, `userdel`, `groupadd`, `groupmod`, and `groupdel`. The `/etc/passwd` and `/etc/group` files store user and group information, respectively. Tools like `chage` (for password aging) and `passwd` (for changing passwords) are also important.
-
Explain the significance of the shell in Linux.
- Answer: The shell is a command-line interpreter that allows users to interact with the Linux kernel. It translates user commands into system calls. Common shells include Bash (Bourne Again Shell), Zsh (Z shell), and others. The shell provides a powerful interface for managing files, running programs, and automating tasks.
-
What are system calls?
- Answer: System calls are functions that provide an interface between user-space programs and the Linux kernel. They allow applications to request kernel services such as accessing files, managing memory, or creating processes. System calls are the fundamental way applications interact with the operating system.
-
Describe the process hierarchy in Linux.
- Answer: Processes in Linux are organized in a hierarchical tree structure. Every process, except for init (process ID 1), is a child of another process. `init` is the first process that starts during the boot process and is responsible for starting other system processes. The `ps` command can be used to view the process hierarchy.
-
How do you monitor system performance in Linux?
- Answer: System performance can be monitored using various tools like `top`, `htop` (interactive version of `top`), `vmstat` (virtual memory statistics), `iostat` (I/O statistics), `iotop` (I/O usage per process), `mpstat` (multiprocessor statistics), and `uptime`. These tools provide information on CPU usage, memory utilization, disk I/O, and network activity.
-
Explain the concept of daemons in Linux.
- Answer: Daemons are background processes that run continuously, providing system services. They typically run with lower priority than interactive processes. Examples include `httpd` (web server), `sshd` (SSH server), and `mysqld` (MySQL server). They are often started automatically during boot.
Thank you for reading our blog post on 'Linux Interview Questions and Answers for 5 years experience'.We hope you found it informative and useful.Stay tuned for more insightful content!