Friday, July 25, 2008

MY linux interview Questions

My Linux Interview Questions

LINUX - Umakata Samantaray

Q1:- If MBR on /dev/had is corrupted how can you fix in linux

Ans:- Reinstall the first stage bootloader with /sbin/grub-install /dev/had

Q2:- How to see on which runlevel you are running?

# /sbin/runlevel

Q3:- How to know what is your current shell you are working?

Ans:- # ps $$

Q4:- How to know what are the shell s are supported by your linux system?

# cat /etc/shells

Q4 (a):- How to know what is your default shell for you

# echo $SHELL

Q5:- How to check what are the ports are open in your linux system?

# netstat -anp --tcp

Q6:- How to know all about a file, like uid, gid, when modified, inode etc

# stat filename

Q7:- How to change shared memory in your system?

To check shared memory- # cat /proc/sys/kernel/shmmax

To change - # echo "67108864" > /proc/sys/kernel/shmmax

This will change to 64MB.

Q8:- What is Inode and how can you find Inode of a file

# ls -i filename

Q9:- How to enable telnet in redhat linux

Q10:- where are the system logs are stored?

/var/log/messages

Q11:- what is the difference between incremental and differential backup?

Q12:- What is the use of /etc/rc file

It is a soft link to /etc/rc.d/rc

This file is responsible for starting/stopping services when the runlevel changes

Q13:- what is /etc/rc.local

It is a soft link to /etc/rc.d/rc.local

This script will be executed *after* all the other init scripts. You can put your own initialization stuff in here if you don't want to do the full Sys V style init stuff

Q14:- What is rc.sysinit

It is soft link to /etc/rc.d/rc.sysinit

It is system initialization script and run only once at the time of booting.

Q15:- How to reconfigure the linuxbox agin

# sys-unconfig

sys-unconfig provides a simple method of reconfiguring a system in a new enviroment. Upon executing sys-unconfig will halt your system, and run the following configuration programs at boot: passwd (to change the root password), netconfig, timeconfig, kbdconfig, authconfig, and ntsysv.

Q16:- How to see system device information?

systool - view system device information by bus, class, and topology

Q17:- How to know all the hardware and software information in a Linux box

# sysreport

This utility will go through and collect some detailed information

about the hardware and setup of your Red Hat Linux system.

This information will be used to diagnose problems.

It will make a directory in your /tmp directory named “sysreport-root.” ( it will show the path at the end of the session) You can get all hard ware information in

# cat hardware.py

If your system hangs while gathering rpm information, please abort

the script with CTRL-C and run it again after adding -norpm to the

sysreport command line

Q18:- what is init script

init, telinit - process control initialization

Init is the parent of all processes. Its primary role is to create

processes from a script stored in the file /etc/inittab (see init-

tab(5)). This file usually has entries which cause init to spawn get-

tys on each line that users can log in. It also controls autonomous

processes required by any particular system.

Q19:- what is runlevels

RUNLEVELS

A runlevel is a software configuration of the system which allows only a selected group of processes to

exist. The processes spawned by init for each of these runlevels are defined in the /etc/inittab file.

( respawn means when a process stopped it restarted)

Init can be in one of eight runlevels: 0â6 and S or s. The runlevel is changed by having a privileged

user run telinit, which sends appropriate signals to init, telling it which runlevel to change to.

Runlevels 0, 1, and 6 are reserved. Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to get the system down into single user mode. Runlevel S is not really meant to be used directly, but more for the scripts that are executed when entering runlevel 1. For more information on this, see the manpages for shutdown(8) and inittab(5).

Runlevels 7-9 are also valid, though not really documented. This is because "traditional" Unix variants donât use them. In case youâre curious, runlevels S and s are in fact the same. Internally they are aliases for the same runlevel.

Q20:- in single user mode root shell is open where

In single user mode, a root shell is opened on /dev/console

Q21:-what is getty?

agetty opens a tty port, prompts for a login name and invokes the /bin/login command. It is normally invoked by init(8)

Q22:- Where you can set default password age, mail directory etc?

/etc/login.def

Q23:- How to debug a script

# bash –x script_file_name

Q24:- Where the kernel modules are stored

/lib/modules/”uname -r”/kernel

Q25:- What is the difference between “insmod” and “modprobe”?

Ans:- insmod â simple program to insert a module into the Linux Kernel

modprobe - program to add and remove modules from the Linux Kernel

lsmod â program to show the status of modules in the Linux Kernel

rmmod â simple program to remove a module from the Linux Kernel

Q26:-How to change Date and time in linux

For change date and time of 7th july 2008 10.16PM, the command is as below

# date 071122162008 or as # date -s "7 JUL 2008 22:16:00"

Time will be always 24hour format

Q27:- What ntsysv do?

ntsysv - simple interface for configuring runlevels. It is a graphical tool of chkconfig.

Q28:- What ldd command do?

ldd prints the shared libraries required by each program or shared library specified on the command line.

Q29:-How you will unmount a device when it shows error t “ The device is busy”?

# fuser –km /dev/device name

Q30:- What are network monitoring tools

mii-tool, ethtool, ehteral, netstat

Q31: - How can you check what the disk I/O now?
# iostat

Q32:- What are the command to check system status

Ethtool, ifconfig, ps, top etc

Q33:- What are the diagnostic tools available in Linux?

Network diagnostic tools- ping, mtr, traceroute, tcpdump -i eth0,

mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.

Server diagnostic tools:- ps, top, sar, vmstat, iostat, mpstat

And /var/log/messages

Q33(a):- what are performance management tools

Top, nice, kill, sar,bg, fg, free etc

Q33(b):- what are network management tools?

Traceroute, route, netstat, dig, ifup, ifdown

Q34:- What is the command to see the processor statistics

mpstat - Report processors related statistics.

Q35:- How can you create multiple users at a time?

newusers - update and create new users in batch

# newusers filename

Filename should be a clear text file which contains username lines, Each line is in the same format as the standard password file

Q36:-What is ksu

Ans:- ksu is a Kerberized version of the su program that has two missions: one is to securely change the real and effective user ID to that of the target user, and the other is to create a new security context.

Q37:- What is udev

Ans:- udev provides a dynamic device directory containing only the files for actually present devices. It

creates or removes device node files in the /dev directory, or it renames network interfaces.


Q38:- How to see the processes in tree format?

#pstree

Q39:- What is pgrep and pkill?

pgrep, pkill - look up or signal processes based on name and other attributes

“ps –ef | grep firefox” is equal to “pgrep firefox”

Pkill will directly kill the process without process id, like “ pkill firefox”

Q40: - What is Tcpwrappers

Q41:- Who has more priority between hosts.allow and hosts.deny?

access rules in hosts.allow are applied first, they take precedence over rules specified in hosts.deny. Therefore, if access to a service is allowed in hosts.allow, a rule denying access to that same service in hosts.deny is ignored.

Q42:- How can you upgrade bios in linux

Ans:- Download the BIOS upgrade file and copy to a floppy which contain Dos or Free dos. Boot from that Floppy and update. For some of the model of Dell has Linux executables for update bios.

Q43:- What is sudo user

Ans:- execute a command as another user/ Allows restricted root access for specified users.

Q44:- How to check the packets going to outside ie to internet

Q45:- What are the antivirus are available for Linux in market?

Ans:- Panda Antivirus for linux, kaspersky antivirus, Avg antivirus, Avast antivirus, Trend Micro, Macafee,

F-PROT Antivirus, Sophos, ClamAV

Q46:-What is malware and how can you protect your linux box form it.

Malicious software, developed for the purpose of harming computers; examples include computer viruses, worms, trojans, and spyware. It can not affect you linux box.

Q47:- What is Dynamic loading?

Q47:- What is nmpa

Q47:- what are the commands available in Linux?

Q48:- How to take remote control of a linux box?

Q49:- How to take remote desktop to another system

ssh -H ipaddress

Q48:- How to start a service

Q49:- From linux kernel come

Q50:- What are the command are available in linux

Q51:- what is nice and renice

Q52:- what is difference between “kill” and “killall”

Q53:- To find all hard links in a file system we need to search by inode. The command to find all the links of inode 8738 in the current directory is _____?

Ans:- find . –inum 8738

No comments: