Linux Interview Questions and Answers
Freshers / Beginner level questions & answers
Ques 1. What is the purpose of the 'chmod' command in Linux?
The 'chmod' command is used to change the permissions of a file or directory in Linux.
Ques 2. Explain the difference between 'rm' and 'rmdir' commands.
'rm' is used to remove files, while 'rmdir' is used to remove empty directories.
Ques 3. What is the role of the 'grep' command in Linux?
'grep' is used for searching patterns in files. It stands for 'Global Regular Expression Print.'
Ques 4. How do you check the free disk space in Linux?
The 'df' command is used to display the amount of disk space available on the file system.
Ques 5. Explain the purpose of the 'ls' command.
'ls' is used to list files and directories in a directory.
Ques 6. What is the purpose of the 'ps' command?
'ps' is used to display information about the currently running processes.
Ques 7. How do you find the process ID (PID) of a running process?
The 'pgrep' or 'pidof' command can be used to find the PID of a running process.
Ques 8. What is a symbolic link in Linux?
A symbolic link is a file that serves as a reference to another file or directory.
Ques 9. Explain the purpose of the 'sudo' command.
'sudo' is used to execute commands with administrative or superuser privileges.
Ques 10. What is the purpose of the 'tar' command?
'tar' is used to create and manipulate archive files.
Intermediate / 1 to 5 years experienced level questions & answers
Ques 11. How do you change the default shell for a user in Linux?
The 'chsh' command is used to change the default shell for a user.
Ques 12. What is the significance of the '/etc/passwd' file?
The '/etc/passwd' file stores user account information, including usernames and home directories.
Ques 13. How can you check the available memory in Linux?
The 'free' command is used to display the amount of free and used memory in the system.
Ques 14. Explain the purpose of the 'cron' scheduler in Linux.
'cron' is a time-based job scheduler in Unix-like operating systems.
Ques 15. What is the 'sudoers' file, and how do you edit it?
The 'sudoers' file contains information about who can run what commands as sudo. It can be edited using 'visudo.'
Ques 16. How do you find and kill a process using its port number?
The 'lsof' command can be used to find the process using a port, and 'kill' can be used to terminate it.
Ques 17. What is the purpose of the 'grep' command with the '-v' option?
The '-v' option in 'grep' is used to invert the match, displaying lines that do not match the pattern.
Ques 18. How do you recursively copy files and directories in Linux?
The 'cp' command with the '-r' or '-R' option can be used to copy files and directories recursively.
Ques 19. What is the purpose of the 'awk' command in Linux?
'awk' is a powerful programming language mainly used for pattern scanning and processing.
Experienced / Expert level questions & answers
Ques 20. Explain the purpose of the 'iptables' command.
'iptables' is used to set up, maintain, and inspect the tables of IP packet filter rules in Linux.
Ques 21. How do you find files larger than a specific size in Linux?
The 'find' command with the '-size' option can be used to find files larger than a specified size.
Ques 22. What is a daemon in Linux?
A daemon is a background process that runs without direct user interaction.
Ques 23. Explain the purpose of the 'chroot' command.
'chroot' is used to change the root directory for a specified command or shell.
Ques 24. How do you check the status of a service in Linux?
The 'systemctl' command is used to check the status of a service in Linux.
Ques 25. What is a shell script in Linux?
A shell script is a series of commands written in a script file to be executed by the shell.
Ques 26. Explain the purpose of the 'umask' command.
'umask' is used to set the default file permissions for newly created files.
Ques 27. How do you create a swap file in Linux?
The 'dd' command and 'mkswap' command are used to create a swap file in Linux.
Ques 28. What is the purpose of the 'crontab' command?
'crontab' is used to create, view, and edit cron jobs in Linux.
Ques 29. How do you find all files modified in the last 7 days?
The 'find' command with the '-mtime' option can be used to find files modified within a specific time frame.
Ques 30. Explain the purpose of the 'rsync' command.
'rsync' is used for file synchronization and transfer between systems.
Ques 31. What is the purpose of the 'ldconfig' command?
'ldconfig' is used to configure dynamic linker run-time bindings.
Ques 32. How do you create a hard link in Linux?
The 'ln' command is used to create hard links in Linux.
Ques 33. Explain the purpose of the 'journalctl' command.
'journalctl' is used to query and display messages from the journal, managed by 'systemd-journald' service.
Ques 34. What is the purpose of the 'crash' command in Linux?
'crash' is used to analyze the Linux kernel core dumps.
Ques 35. How do you change the hostname in Linux?
The 'hostnamectl' command is used to change the hostname in Linux.
Ques 36. Explain the purpose of the 'journalctl' command.
'journalctl' is used to query and display messages from the journal, managed by 'systemd-journald' service.
Ques 37. What is the purpose of the 'crash' command in Linux?
'crash' is used to analyze the Linux kernel core dumps.
Ques 38. How do you change the hostname in Linux?
The 'hostnamectl' command is used to change the hostname in Linux.
Ques 39. What is the purpose of the 'journalctl' command.
'journalctl' is used to query and display messages from the journal, managed by 'systemd-journald' service.
Ques 40. What is the purpose of the 'crash' command in Linux?
'crash' is used to analyze the Linux kernel core dumps.
Ques 41. How do you change the hostname in Linux?
The 'hostnamectl' command is used to change the hostname in Linux.
Ques 42. What is the purpose of the 'journalctl' command.
'journalctl' is used to query and display messages from the journal, managed by 'systemd-journald' service.
Ques 43. What is the purpose of the 'crash' command in Linux?
'crash' is used to analyze the Linux kernel core dumps.
Most helpful rated by users:
Related interview subjects
Glassfish interview questions and answers - Total 8 questions |
Ubuntu interview questions and answers - Total 30 questions |
Linux interview questions and answers - Total 43 questions |
Unix interview questions and answers - Total 105 questions |
Weblogic interview questions and answers - Total 30 questions |
Tomcat interview questions and answers - Total 16 questions |