Linux Commands Interview Questions And Answers

Download Linux Commands Interview Questions and Answers PDF

Strengthen your Linux Commands interview skills with our collection of 23 important questions. Our questions cover a wide range of topics in Linux Commands to ensure you're well-prepared. Whether you're new to the field or have years of experience, these questions are designed to help you succeed. Download the free PDF to have all 23 questions at your fingertips. This resource is designed to boost your confidence and ensure you're interview-ready.

23 Linux Commands Questions and Answers:

Linux Commands Job Interview Questions Table of Contents:

Linux Commands Job Interview Questions and Answers
Linux Commands Job Interview Questions and Answers

1 :: 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.
Read More

2 :: 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
Read More

3 :: Explain any one service which are working on UDP
only?

BOOTPS (67port number)
BOOTPC(68 port number)

belongs to DHCP
Read More

4 :: how many interfaces(ethernet cards) are
working using single command?

#ifconfig -a

except loopback
Read More

5 :: 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.
Read More

6 :: 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
Read More

7 :: 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.
Read More

8 :: 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
Read More

9 :: 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
Read More

10 :: 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 ]
Read More

11 :: 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
Read More

12 :: 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.
Read More

13 :: 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.
Read More

14 :: What is the command to find the hardware configuration in Linux?

dmidecode | less
Read More

15 :: How to root mirror in Linux? How to replace mirrored hdd in case of failure?

we need to create raid level 1 in linux. and create a
backup of data.
Read More

16 :: 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
#
Read More

17 :: 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>
Read More

18 :: 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
Read More

19 :: 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
Read More

20 :: 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
Read More

21 :: How to shuffle the GRUB booting from one Disk to other?

grub> map (hd0) (hd1)
grub> map (hd1) (hd0)
Read More

22 :: 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.
Read More

23 :: 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
Read More