Linux Interview Questions for Freshers Part-1

Hello Techies, In this post we are going to discuss 40 basic Linux interview questions for freshers or beginners. These questions will give you an idea about what type of questions generally asked for Linux administrator Job.
Q:1 What will happen when you execute the command “mv *” in your current directory ?
Ans : Linux Shell usually expand * in alphabetical Order, So When we execute the command “mv *” then it will check the file and directories alphabetically order and will move all the files and directories to the directory which is created in the last according to alphabetical order, if alphabetically a file is created in the last then command will through an error
” mv: target ‘x’ is not a directory.
Q:2 Tell me the main difference between SSH and Telnet command ?
Ans : Both SSH and telnet are used to connect remote servers. SSH stands for Secure Shell and When we do ssh to any server then data (User’s Credentials) is transferred in an encrypted form between the client and server but in case of Telnet data is transferred in plain text. Intruder can easily extract the confidential info in case of telnet.
Q:3 What is RAID and why it is required ?
Ans : RAID Stands for Redundancy Array inexpensive Disk, it is required to provide high availability and redundancy in case of hard disk failure in physical servers. We can also used RAID to increase disk throughput via striping
Q:4 How to check when was the particular rpm installed on your server ?
Ans : Use the rpm command “rpm -q {rpm_name} –last”
Q:5 How to check number of open files of a particular user ?
Ans : Using lsof command we find number of files associated to particular user.
lsof -u apache
lsof -u apache | wc -l
Q:6 How to check what is your current working shell ?
Ans : echo $SHELL and ‘/etc/passwd’ will tell you your default shell.
Q:7 Is it possible to do a dry-run installation of a RPM ?
Ans : Yes, it is possible with option “–test” with rpm command like “rpm -ivh –test“, this command will not install rpm package but it will check whether rpm installation will be successful or not.
Q:8 How to check whether a local linux user account is locked or not ?
Ans : Using the passwd command “passwd -S ” we can check whether the password is set or not. Moreover we can also see the login failed attempts using “pam_tally2 -u {user_name}“. If login failed attempts cross the limit then account will be locked.
Q:9 How to check when was the password changed for local Linux user ?
Ans : Use the chage command “chage -l {user_name}“, there is entry in the output “Last password change” from there we can check the date.
Q:10 What are the different fields of /etc/passwd file ?
Ans : There are 7 fields in /etc/passwd file
User Name
Password ( x character that shows password is encrypted and kept in /etc/shadow file)
UID
GID
Comments for the User
Home directory
Shell
Q:11 what is the toggle id for LVM partition in Linux ?
Ans : “8e” is the toggle id in fdisk command for Linux LVM partition.
Q:12 How to find access and modify time of a file and directory in linux ?
Ans : Using the ‘stat’ command we can find the access and modify time of a file and directory. Example is shown below :
stat {file_name}
stat {Directory_name}

Be the first to comment

Leave a Reply

Your email address will not be published.


*