Top 5 Linux Interview Questions

In this blog post we will provide Top 5 Linux Interview Question for you. This questions is based on real interviews and these questions asked by the interviewer to the candidates.

In this new world all most IT (Information Technology) companies uses Linux operating system for the security purpose and they hire a good candidate which have knowledge of Linux commands and fit to their environment.

Top 5 Linux Interview Question & Answers

  1. What is the default permission of file? Can we change this.?

Answer – The default file permission is 644 (rw-r–r–) and we can change this easily.

2. What is the default permission of directory.?

Answer – The default directory permission is 755 (rwxr-xr-x).

3. How to Lock/Unlock user account.?

Answer – To lock a user account use this command :- #usermod -L username

and to unlock a user account use this command :- #usermod -U username

4. How to remove command permission from the root account like (chmod command).?

Answer – When you remove execution of chmod command after that, this command will not wok on the Linux system. And after that you will not perform any change mode permission on the system.

To remove chmod permission from root, use this command : – #chmod -x /bin/chmod

To revoke this permission to the root, use this command :- #setfacl -m u::rx /bin/chmod

Note:- Please don’t use this command on any production server to face the issue. This is only for testing/learning purpose.

5. How to find UID using awk command which is greater than 500.?

Answer – To find the UID number using awk command : – awk -F: ‘$3>500’ /etc/passwd

and if you want to print only name of the users which have greater than 500 UID, then use this command :-  #getent passwd | awk -F: ‘$3>500 {print $1}’

where, $3 is the postion of UID number in /etc/passwd file and $1 is the name position.

Leave a Comment