3. Linux Interview Questions Along With Answers -

1)  What is GRUB
Ans GNU GRUB is a Multiboot boot loader. It was derived from GRUB, the GRand Unified Bootloader,
which was originally designed and implemented by Erich Stefan Boleyn.
Briefly, a boot loader is the first software program that runs when a computer starts. It is
responsible for loading and transferring control to the operating system kernel software
(such as the Hurd or Linux). The kernel, in turn, initializes the rest of the operating
system (e.g. GNU)
2) Explain Linux Boot Process
Ans http://www.thegeekstuff.com/2011/02/linux-boot-process/
3) Which files are called for user profile by default when a user gets login
Ans $HOME/.bash_profile, $HOME/.bash_bashrc
4) Which file needs to update if srequired to change default runlevel 5 to 3
Ans File is /etc/inittab and required to change below lines:
id:5:initdefault: to id:3:initdefault:
5) What command used for showing user info like Login Name, Canonical Name, Home Directory,Shell etc..
Ans FINGER command can be used i.g; finger username

6) What is inode number
Ans An inode is a data structure on a traditional Unix-style file system such as UFS or ext3. An
inode stores basic information about a regular file, directory, or other file system object
iNode number also called as index number, it consists following attributes:
File type (executable, block special etc)
Permissions (read, write etc)
Owner
Group
File Size
File access, change and modification time (remember UNIX or Linux never stores file creation
time, this is favorite question asked in UNIX/Linux sys admin job interview)
File deletion time
Number of links (soft/hard)
Extended attribute such as append only or no one can delete file including root user
(immutability)
Access Control List (ACLs)

Following command will be used to show inodes of file and folders:
ls -i
Following command will show complete info about any file or folders with inode number
stat file/folder
Files/Folders can also be deleted using inode numbers with following command:
find out the inode number using 'ls -il' command then run below command
find . -inum inode_number -exec rm -i {} \;
7) How can we increase disk read performance in single command
Ans blockdev command
This is sample output - yours may be different.
# Before test
$ blockdev --getra /dev/sdb
256
$ time dd if=/tmp/disk.iso of=/dev/null bs=256k
2549+1 records in
2549+1 records out
668360704 bytes (668 MB) copied, 6,84256 seconds, 97,7 MB/s
real 0m6.845s
user 0m0.004s
sys 0m0.865s
# After test
$ blockdev --setra 1024 /dev/sdb
$ time dd if=/tmp/disk.iso of=/dev/null bs=256k
2435+1 records in
2435+1 records out
638390272 bytes (638 MB) copied, 0,364251 seconds, 1,8 GB/s
real 0m0.370s
user 0m0.001s
sys 0m0.370s
8) .... command to change user password expiration time
Ans CHAGE
9) Command used to lock user password
Ans usermod -L username
10) How many default number of Shells available and what are their names?
Ans SH, BASH, CSH, TCSH, NOLOGIN, KSH
11) Which file defines the attributes like UID, PASSWORD expiry, HOME Dir create or not while
adding user
Ans /etc/login.defs
12) ...... command used for changing authentication of linux system to LDAP/NIS/SMB/KERBOS
Ans authconfig
13) ...... command used for changing the attributes of any file
Ans chattr
14) What is the path of network (ethX) configuration files
Ans /etc/sysconfig/network-scripts/ethX
15) How can we change speed and make full duplex settings for eth0
Ans We can do this with below given 2 methods:
ethtool -s eth0 speed 100 duplex full
ethtool -s eth0 speed 10 duplex half
OR
mii-tool -F 100baseTx-HD
mii-tool -F 10baseT-HD
16) File which stores the DNS configuration
Ans /etc/resolve.conf
17) Main configuration file and command used for NFS enabling exported directories and deamons
Ans /etc/exports and exportfs -av , deamons are quotad, portmapper, mountd, nfsd and nlockmgr/status
18) What is command to check ports running/used over local machine
Ans netstat -antp
19) What is the command to check open ports at remote machine
Ans nmap
20) What is the difference between soft and hard links
Ans Soft Links => 1) Soft link files will have different inode numbers then source file
2) If original file deleted then soft link file be of no use
3) Soft links are not updated
4) Can create links between directories
5) Can cross file system boundaries
Hard Links => 1) Hard links will have the same inode number as source file
2) Hard links can not link directories
3) Can not cross file system boundaries
4) Hard links always refers to the source, even if moved or removed


21) How to setup never expired user password
Ans chage -E never username
22) Restricting insertion into file if full permission are assigned to all
Ans chattr +i filename
23) Display or Kill all processes which are accessing any folder/file
Ans Display User who are using file/folder : fuser -u file/folder
Kill All Processes which are using file/folder: fuser -k file/folder
24) Kill any user's all processes
Ans killall -u username
25) How can we have system analysis and reports over mail
Ans Use logwatch



_____________________________________________________________________________________________
Click Back..                                Click Home..

https://docs.google.com/forms/d/1iNRZlJJO6rBFizzPcFmyOTEtfkdjhdVRmpM74IbiT3o/viewform