questions-interviews.com

Interview Questions and Answers, Frequently Asked Questions (FAQs) and Useful Articles

Home  >> Interview Questions and Answers  >> Operating System  >> Linux Commands Interview Questions and Answers

Interview Questions & Answers


Linux Commands Interview Questions and Answers


This page contains the collection of Linux Commands Interview Questions and Answers / Frequently Asked Questions (FAQs) under category Operating System. These questions are collected from various resources like informative websites, forums, blogs, discussion boards including MSDN and Wikipedia. These listed questions can surely help in preparing for Linux Commands interview or job.

Explain difference between nfs soft and hard mouniting points?
hard mount option:- If the client fails to access the server,then connection hang it, after the system up then it access the server. Soft:- If the client failed to connect the server it immediately gives the error report, and close the connection.

If we transfer 100 files by ftp to remote server, how to know the files are successfully transfer or some file are not transferred?
after transferring the files look into the present working directory of the client machine for the transferred files and cross check it.
else you can check the total number of files transferred to the client machine in present working directory using this command
ls -l | wc -l

Explain any one service which are working on UDP only?
BOOTPS (67port number)
BOOTPC(68 port number)
belongs to DHCP

How many interfaces(ethernet cards) are working using single command?
#ifconfig -a
except loopback

What is the status code 403,404 represented in apache server?
403 represent forbidden error, means if files misses some selinux security context is missing.
404 represent that their is a cgi script missing or web pages missing.

How to monitor ports in a linux machine, with single command?
nmap is not the default available command.we can use netstat netstat -nl, netstat -nltp ,netstat -nulp

Explain Difference between swap partition and swap file?
Swap partition maintained seperate partition. same swap partition can be used in two OS within single machine.
If system crashes their is a chance to recover itor may not be corrupt the partition.
Less fragmented.
where as swap file takes very less space. we can increase the space very easily, compared to swap partition. SWap file system fragmented. If system crashes their is a huge chance to lost the swap file system.

How to recover /etc/passwd file and /etc/shadow file?
## In that case you need to recover /etc/passwd file first.
For this you have to following steps,

-Start GRUB on boot (press ESC while booting)
-Press e over (recovery mode)
-Press e over the line beginning with kernel
-Press Space bar and enter "init=/bin/bash"
-Press enter
-Press b
-At command prompt type: "cp /etc/passwd- /etc/passwd"
-reboot to GRUB again
-Press e over (recovery mode)
-Press e over the line beginning with kernel
-Press Space bar and enter "init=/bin/bash"
-Press enter
-Press b
-At command prompt type "mount -o remount,rw /"
-Type "passwd YOURUSERNAMEHERE" (IF you don't know your user
name type "ls /home" (that is a Lower case L and lower case
S) for a list of users)
-Enter new password at prompt
-reboot to normal boot.

Hope that helps others like it did me!

### Then to recover /etc/shadow file, Use following command
pwconf

This command will generate /etc/shadow file from /etc/passwd

How to know linux os is 32 bit or 64 bit?
#uname -a
we get the information about os
and Regarding CPU
#grep flags /proc/cpuinfo
if cpu is in
Long mode - 64 bit CPU
Real mode 16 bit CPU
Protected Mode is 32-bit CPU

Suppose I lost a root password and i need to give it, I treid to change it through single usermode even though i am not get a password, then what is the other procedure to give a root password?
Login into single user mode and try below things:
1. passswd [ Change Password for root ]
2. rm -rf /etc/nologin
3. remove any "nologin" shell for root user in /etc/passwd file
4. chage -l root then chage -E root
5. passwd -u root
6. chattr -i /etc/passwd /etc/shadow
7. chmod 600 /etc/securetty
8. vim /etc/rc.local --> then remove any line like say "
/etc/nplogin "
9. chsh root [ /bin/bash ]

What are different command to check ram, process and hdd of linux machine?
RAM : We will check RAM, Process as well as HDD by the root
user...

RAM : #free
#cat /proc/meminfo

Process : ps -a -> It will show running process within all
terminals..

Hard Disk : #fdisk -l

What is lilo? How it is useful in linux?
LILO (LInux LOader) is a boot loader (a small program that manages a dual boot) for use with the Linux operating system. Most of the new computers are shipped with boot loaders for some version of Microsoft Windows or the Mac OS. If a computer is to be used with Linux, a special boot loader must be installed. LILO is the most popular boot loader among users.

What is the command to change from /etc/passwd file to /etc/shadow file?
#pwconv
-> It convert /etc/passwd to /etc/shadow

#pwunconv
-> It convert /etc/shadow to /etc/shadow

you can check both file after running pwconv and pwunconv
cmd to get difference.

What is the command to find the hardware configuration in Linux?
dmidecode | less

How to root mirror in Linux? How to replace mirrored hdd in case of failure?
W
e need to create raid level 1 in linux. and create a backup of data.

What is the command to check wwn # in linux?
Emulex HBA Adaptor.

Find the WWPN.
Step1:
Confirm if the HBA is Emulex.
# lspci
......
0e:00.0 Fibre Channel: Emulex Corporation Zephyr LightPulse
Fibre Channel Host Adapter (rev 02)
17:00.0 Fibre Channel: Emulex Corporation Zephyr LightPulse
Fibre Channel Host Adapter (rev 02)
#

Step2:
# cd /sys/class/fc_host/
# ls -l
total 0
drwxr-xr-x 3 root root 0 Oct 14 20:57 host0
drwxr-xr-x 3 root root 0 Oct 14 20:57 host1
# cat port_name
0x10000000c97a37cf
#

How to give acl permission in numerical mode on linux?
By using chmod command for example chmod 777 <file name> its for full permissionof the file
read =4
write =2
execute=1
user group other
7 7 7
4+2+1 4+2+1 4+2+1
r+w+e r+w+e r+w+e
other example
we give permission to user to full and give group and other
to only read and execute than
chmod 755 <file name>

How to restart apache server with out shatdown?
Whenever you want restart Apache web server without shutdown Apache web server that time you use the commands service httpd reload ,if you type the commands service httpd restart that time frist shut down the service then startup the service but if you type commands service httpd reload, only read the configuration file and startup the service.

What is chainloading?
The chainloading technique tells GRUB to read +n sectors from the start of the partition. Usually n = 1. The chainloading command may specify also a file name: chainloader +1 read 1 sector from start of the partition chainloader /boot/chain.os2 load a file.

How to hide the partition in GRUB booting?
grub> unhide (hd0,0)
grub> hide (hd0,1)
grub> rootnovery (hd0,0)
grub> chainloader +1
grub> makeactive
grub> boot

How to shuffle the GRUB booting from one Disk to other?
grub> map (hd0) (hd1)
grub> map (hd1) (hd0)

What is the Difference between su and su- ?
there is little difference in both of these commends...
su --> just switch you to user mode (root) but didn't provide the complete user environment
su - ---> provide you the complete user environment and also direct jump to user home directory.

What is vnc?
vnc or virtual network computing is a way computing remote computer in linux world.when you connect a vnc client to a remote computer using vnc server we an take the full acces of that client computer.
to check installed or not
rpm -qa | grep vnc
configuration file
vi /etc/sysconfig/vncservers

Top