These are some common questions that most of the time interviewers ask to know your knowledge of Linux Administration.
Here I am sharing some top 10 questions that may help you to crack your next Linux interview.
Interview Questions
- What is Linux?
Linux is an open source Unix-like operating system based on the Linux kernel. The first Linux kernel released by Linus Torvalds, on 17th September 1991.
- Explain how boot process works?
There are 6 stages in the boot process. Whenever we press power button, Linux server turns on and starts BIOS(Basic Input/Output System). BIOS executes MBR (Master Boot Record), MBR executes GRUB(Grand Unified Boot Loader), GRUB executes Kernel, Kernel executes /sbin/init, init executes run level programs, run levels are executed from /etc/rc.d/rc*.d/
BIOS >> MBR >> GRUB >> Kernel >> init >> runlevel - How to check open ports in Linux?
We can check open ports using lsof or netstat commands.
# lsof -i -P -n | grep LISTEN
# netstat -tulpn | grep LISTEN - How to check filesystem type in Linux?
Check file system types by using these two commands.
# lsblk
# fdisk -l - Some important port numbers, interviewer may ask.
dns 53
ftp 20 21
ssh 22
dhcp 68
telnet 23
smtp 25, 465, 587, 2525 - How to scan newly added physical disk on Linux?
If newly added physical disk not detected on OS then we need to scan manually. Use this command to detect new disk.
# echo “- – -” > /sys/class/scsi_host/host0/scan - How to check IP address in Linux Operating System?
The IP address is the identification of the server. We can check IP address and gateway details of the server by using below commands.
# ifconfig
# ip addr
# ip a
Also check IP and gateway details on network file which is ‘/etc/sysconfig/network-scripts/ifcfg-<yournetwork-card name>’ - How to transfer files between two linux severs securily?
To copy file in Linux we use the ‘cp’ command but this command works on local only. If you want to copy between two servers you need to use the secure copy command ‘scp’. SCP command helps to copy files from one Linux server to another Linux server safely.
Syntax example:
# scp -rp <filename> user@remoteserverIP:<destination-path>
# scp -rp file.txt root@192.168.39.2:/tmp - What is LVM?
LVM stands for Logical Volume Manager. Which helps to increase or decrease filesystem size online. The standard partition is not possible to extend but LVM partition can extend the required size without any data loss. To extend LVM partition we need to have free space on VG(Volume Group)
We extend the LVM partition using ‘lvextend’ command. - What is an inode?
index node(inode) is a data structure in a Unix based file system that describes a filesystem object such as a file or a directory. It contains details about a file/folder such as size of the file, owner, device node, socket etc., The number of inodes on your account equals to the number of files and folders you have on it.