Вы находитесь на странице: 1из 42

IMP-URL----http://www.sanfoundry.

com/technical-interview-questions/
Download Linux interview questions and answers
Beginners UNIX Interview Questions Answers
1. Write command to list all the links from a directory?
In this UNIX command interview questions interviewer is generally checking whether user
knows basic use of "ls" "grep" and regular expression etc
You can write command like:
ls -lrt | grep "^l"
2. Create a read-only file in your home directory?
This is a simple UNIX command interview questions where you need to create a file and
change its parameter to read-only by using chmod command you can also change your
umask to create read only file.
touch file
chmod 400 file
read more about file and directory permission in unix and linux here.
3. How will you find which operating system your system is running on in UNIX?
By using command "uname -a" in UNIX
4. How will you run a process in background? How will you bring that into
foreground and how will you kill that process?
For running a process in background use "&" in command line. For bringing it back in
foreground use command "fg jobid" and for getting job id you use command "jobs", for
killing that process find PID and use kill -9 PID command. This is indeed a good Unix
Command interview questions because many of programmer not familiar with background
process in UNIX.
5. How do you know if a remote host is alive or not?
You can check these by using either ping or telnet command in UNIX. This question is most
asked in various Unix command Interview because its most basic networking test anybody
wants to do it.

6. How do you see command line history in UNIX?


Very useful indeed, use history command along with grep command in unix to find any
relevant command you have already executed. Purpose of this Unix Command Interview
Questions is probably to check how familiar candidate is from available tools in UNIX
operation system.
7. How do you copy file from one host to other?
Many options but you can say by using "scp" command. You can also use rsync command
to answer this UNIX interview question or even sftp would be ok.
8. How do you find which process is taking how much CPU?
By using "top" command in UNIX, there could be multiple follow-up UNIX command
interview questions based upon response of this because TOP command has various
interactive options to sort result based upon various parameter.
9. How do you check how much space left in current drive ?
By using "df" command in UNIX. For example "df -h ." will list how full your current drive
is. This is part of anyone day to day activity so I think this Unix Interview question will be to
check anyone who claims to working in UNIX but not really working on it.
10. What is the difference between Swapping and Paging?
Swapping:
Whole process is moved from the swap device to the main memory for execution. Process
size must be less than or equal to the available main memory. It is easier to implementation
and overhead to the system. Swapping systems does not handle the memory more flexibly
as compared to the paging systems.
Paging:
Only the required memory pages are moved to main memory from the swap device for
execution. Process size does not matter. Gives the concept of the virtual memory. It
provides greater flexibility in mapping the virtual address space into the physical memory of
the machine. Allows more number of processes to fit in the main memory simultaneously.
Allows the greater process size than the available physical memory. Demand paging
systems handle the memory more flexibly.

1. What is difference between ps -ef and ps -auxwww?


This is indeed a good Unix Interview Command Question and I have faced this issue while
ago where one culprit process was not visible by execute ps ef command and we are
wondering which process is holding the file.
ps -ef will omit process with very long command line while ps -auxwww will list those
process as well.
2. How do you find how many cpu are in your system and there details?
By looking into file /etc/cpuinfo for example you can use below command:
cat /proc/cpuinfo
3. What is difference between HardLink and SoftLink in UNIX?
I have discussed this Unix Command Interview questions in my blog post difference
between Soft link and Hard link in Unix
4. What is Zombie process in UNIX? How do you find Zombie process in UNIX?
When a program forks and the child finishes before the parent, the kernel still keeps some
of its information about the child in case the parent might need it - for example, the parent
may need to check the child's exit status. To be able to get this information, the parent calls
'wait()'; In the interval between the child terminating and the parent calling 'wait()', the
child is said to be a 'zombie' (If you do 'ps', the child will have a 'Z' in its status field to
indicate this.)
Zombie : The process is dead but have not been removed from the process table.
5. What is "chmod" command? What do you understand by this line r-- -w- --x?
6. There is a file somewhere in your system which contains word
"UnixCommandInterviewQuestions How will find that file in Unix?
By using find command in UNIX for details see here 10 example of using find command in
Unix
7. In a file word UNIX is appearing many times? How will you count number?
grep -c "Unix" filename

8. How do you set environment variable which will be accessible form sub shell?
By using export

for example export count=1 will be available on all sub shell.

9. How do you check if a particular process is listening on a particular port on


remote host?
By using telnet command for example telnet hostname port, if it able to successfully
connect then some process is listening on that port. To read more about telnet read
networking command in UNIX
10. How do you find whether your system is 32 bit or 64 bit?
Either by using "uname -a" command or by using "arch" command.
Advanced UNIX Interview Questions and Answers
1. How do you find which processes are using a particular file?
By using lsofcommand in UNIX. It wills list down PID of all the process which is using a
particular file.
2. How do you find which remote hosts are connecting to your host on a particular
port say 10123?
By using netstat command execute netstat -a | grep "port" and it will list the entire host
which is connected to this host on port 10123.
3. What is nohup in UNIX?
4. What is ephemeral port in UNIX?
Ephemeral ports are port used by Operating system for client sockets. There is a specific
range on which OS can open any port specified by ephemeral port range.
5. If one process is inserting data into your MySQL database? How will you check
how many rows inserted into every second?
Purpose of this Unix Command Interview is asking about "watch" command in UNIX which
is repeatedly execute command provided with specified delay.
6. There is a file Unix_Test.txt which contains words Unix, how will you replace all
Unix to UNIX?

You can answer this Unix Command Interview question by using SED command in UNIX for
example you can execute sed s/Unix/UNIX/g fileName.
7. You have a tab separated file which contains Name, Address and Phone
Number, list down all Phone Number without there name and Addresses?
To answer this Unix Command Interview question you can either you AWK or CUT command
here. CUT use tab as default separator so you can use
cut -f3 filename.
8. Your application home directory is full? How will you find which directory is
taking how much space?
By using disk usage (DU) command in Unix for example du sh . | grep G will list down all
the directory which has GIGS in Size.
9. How do you find for how many days your Server is up?
By using uptime command in UNIX
10. You have an IP address in your network how will you find hostname and vice
versa?
This is a standard UNIX command interview question asked by everybody and I guess
everybody knows its answer as well. By using nslookup command in UNIX, you can read
more about Convert IP Address to hostname in Unix here.
I hope this UNIX command interview questions and answers would be useful for quick
glance before going for any UNIX or Java job interview. Please share any interesting UNIX
command interview you have come across and I will add into this list. If you are going for
any Unix interview on brokerage firm or stock trading company or any Investment bank you
can have a quick look here, though most of questions you might already know but its good
to review it. if you like this you can see my other unix command tutorial for beginners as
well

10 Examples of tar command in UNIX and Linux


tar command in UNIX or Linux is one of the important command which provides archiving
functionality in unix. we can use UNIX tar command to create compressed or uncompressed

archive files by using either gzip or bzip2. In this unix tar command tutorial we will see
examples of unix tar command related to basic archiving task e.g. How to create tar
archive in Unix and Linux, How to extract files from tar archive in unix, How to view
contents of tar file in Unix and Linux or how to update and existing tar file in Unix. Examples
of tar command in unix are kept simple and easy to understand and master each of basic
task using unix tar command.
I thought about this article when I written how to be productive in UNIX and UNIX command
tutorial and Example for beginners but somehow it gets delayed and now I am happy to see
this published.
Ok enough introduction now let's see some real life examples of tar command in Unix and
Linux:

How to use tar command in Unix


Using tar command in UNIX is simple and it has similar syntax like any other UNIX
command. below is the syntax of tar command in UNIX:
tar [options] [name of tar file to be created] [list of files and directories to be included]
This syntax of tar command is for easy understanding you can also check detailed syntax
by using command "tar --usage" in unix machine.
tar command examples in Linux

Unix tar command line options


--------------------------------------In this section of UNIX tar command tutorial we will see some useful options of tar
command in Linux and we will use this options on our example to understand usage of this
option along-with tar command.
c -- create, for creating tar file
v -- verbose, display name of files including,excluding from tar command
f -- following, used to point name of tar file to be created. it actually tells tar command that
name of the file is "next" letter just after options.

x -- extract, for extracting files from tar file.


t -- for viewing content of tar file
z -- zip, tells tar command that create tar file using gzip.
j - another compressing option tells tar command to use bzip2 for compression
r -- update or add file or directory in already existed .tar file
wildcards -- to specify patters in unix tar command

How to create tar archive or tar file in Unix


------------------------------------------------------Most of use use either winzip or winrar in windows machine to zipping or creating archives
of content so when we move to command line interface like Unix or Linux we struggle
without those tools. UNIX tar command is similar to winzip or winrar and you can use UNIX
tar command to create both compressed or uncompressed (zipped) archives in UNIX.
In this example of tar command we will create tar file including all the files and directories
or selected files and directories in Unix.
here is our directory
stock_trader@system:~/test ls -lrt
total 0
-r--r--r-- 1 stock_trader Domain Users 0 Jul 15 11:42 equity
drwxrwxrwx+ 1 stock_trader Domain Users 0 Jul 15 14:33 stocks/
-r--r--r-- 1 stock_trader Domain Users 0 Jul 15 15:30 currency
it has two files and one directory. now we will create a tar file with all these contents.
stock_trader@system:~/test tar -cvf trading.tar *
currency
equity
stocks/
stocks/online_stock_exchanges.txt

You see unix tar command is creating tar file with name "trading" with contents shown
above. just to review here "-c" is used to create tar file "v" is used to be verbose and "f" is
used to tell tar file name. You can see the tar file here
stock_trader@system:~/test ls -lrt
-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 11:42 equity

drwxrwxrwx+ 1 stock_trader Domain Users


-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 14:33 stocks/

0 Jul 15 15:30 currency

-rw-r--r-- 1 stock_trader Domain Users 10K Jul 18 12:29 trading.tar

How to view contents of tar file in Unix or Linux


------------------------------------------------------------In earlier example of tar command in Unix or Linux we have created a uncompressed tar file
called "trading.tar" now in this example we will see the actual content of that tar file.
stock_trader@system:~/test tar -tvf trading.tar
-r--r--r-- stock_trader/Domain Users 0 2011-07-15 15:30 currency
-r--r--r-- stock_trader/Domain Users 0 2011-07-15 11:42 equity
drwxrwxrwx stock_trader/Domain Users 0 2011-07-15 14:33 stocks/
-rwxrwxrwx stock_trader/Domain Users 0 2011-07-15 14:33
stocks/online_stock_exchanges.txt
here option "t" is used to display content of tar file in unix while options "v" and "f" are for
"verbose" and "following". now you can clearly see that all the files which we wanted to be
included in tar file are there.

How to extract contents from a tar file in Unix


----------------------------------------------------------In this example of unix tar command we will see how to extract files or directories from a
tar file in unix or Linux. We will use same trading.tar file created in earlier example. In this
example we will create a directory "trading" and extract contents of trading.tar on that
directory.

stock_trader@system:~/test/new ls -lrt
total 12K
-rw-r--r-- 1 stock_trader Domain Users 10K Jul 18 12:37 trading.tar
Now the directory is empty just trading.tar file
stock_trader@system:~/test/new tar -xvf trading.tar
currency
equity
stocks/
stocks/online_stock_exchanges.txt
This unix tar command will extract content of trading.tar in current directory. "x" is used for
extracting. "v" is again for verbose and optional parameter in all our example.
stock_trader@system:~/test/new ls -lrt
-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 11:42 equity

drwxr-xr-x+ 1 stock_trader Domain Users


-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 14:33 stocks/

0 Jul 15 15:30 currency

-rw-r--r-- 1 stock_trader Domain Users 10K Jul 18 12:37 trading.tar


Now you can see that all the files and directories which were included in tar file (stocks,
equity and currency) has been extracted successfully.

How to create tar file in Unix with just specified contents


------------------------------------------------------------------------In above example of tar command in unix we have created tar file with all the contents
available in current directory but we can also create tar file with selective content as shown
in above example.
Now in our current directory we have both files and directories and we just want to include
two files equity and currency in our tar file.
stock_trader@system:~/test ls -lrt
-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 11:42 equity

drwxrwxrwx+ 1 stock_trader Domain Users


-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 14:33 stocks/

0 Jul 15 15:30 currency

-rw-r--r-- 1 stock_trader Domain Users 10K Jul 18 12:29 trading.tar


drwxr-xr-x+ 1 stock_trader Domain Users

0 Jul 18 12:46 new/

stock_trader@system:~/test tar -cvf equitytrading.tar equity currency


equity
currency
you see only two files equity and currency are included in our tar file.

How to create compressed tar file using gzip in Unix


-----------------------------------------------------------------In our previous example of Linux tar command we have created uncompressed tar file but
most of the time we also need to create compressed tar file using gzip or bzip2. In this
example of tar command in Linux we will learn about creating tar file using gzip.
stock_trader@system:~/test tar -zcvf trading.tgz *
currency
equity
stocks/
stocks/online_stock_exchanges.txt
you see creating tar file with gzip is very easy just use "-z" option and it will crate a gzip tar.
.tgz or tar.gz extension is used to denote tar file with gzip. size of a compressed tar file is
far less than uncompressed one.
stock_trader@system:~/test ls -lrt
-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 11:42 equity

drwxrwxrwx+ 1 stock_trader Domain Users


-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 14:33 stocks/

0 Jul 15 15:30 currency

-rw-r--r-- 1 stock_trader Domain Users 219 Jul 18 13:01 trading.tgz

you can also view contents of gzip tar file by using earlier command in combination of "z"
option and same is true for extracting content from gzip tar. below examples of unix tar
command will show how to view contents of .tgz or .tar.gz file in unix.
stock_trader@system:~/test tar -ztvf trading.tgz
-r--r--r-- stock_trader/Domain Users 0 2011-07-15 15:30 currency
-r--r--r-- stock_trader/Domain Users 0 2011-07-15 11:42 equity
drwxrwxrwx stock_trader/Domain Users 0 2011-07-15 14:33 stocks/
-rwxrwxrwx stock_trader/Domain Users 0 2011-07-15 14:33
stocks/online_stock_exchanges.txt
Similarly we can extract contents from a .tgz or .tar.gz file as shown in below example of
unix tar command :
stock_trader@system:~/test/new tar -zxvf trading.tgz
currency
equity
stocks/
stocks/online_stock_exchanges.txt
stock_trader@system:~/test/new ls -lrt
-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 11:42 equity

drwxr-xr-x+ 1 stock_trader Domain Users


-r--r--r-- 1 stock_trader Domain Users

0 Jul 15 14:33 stocks/

0 Jul 15 15:30 currency

-rw-r--r-- 1 stock_trader Domain Users 219 Jul 18 13:07 trading.tgz

How to create compressed tar file using bzip2 in Unix


-------------------------------------------------------------------bzip2 is another compression option we have which we can use with unix tar command. its
exactly similar with our earlier option of compressing using gzip but instead of "z" option we
need to use "j" tar option to create bzip2 file as shown in below example of tar command in
unix.
stock_trader@system:~/test tar -jcvf trading.tar.bz2 *
currency

equity
stocks/
stocks/online_stock_exchanges.txt
stock_trader@system:~/test ls -lrt trading.tar.bz2
-rw-r--r-- 1 stock_trader Domain Users 593 Jul 18 13:11 trading.tar.bz2
.tar.bz2 is used to denote a tar file with bzip2 compression. for viewing contents of bzip2 tar
file and extracting content we can use as shown inexample of UNIX tar command with
gzip compression, just replace "-z" with "-j" for bzip2.
How to extract a particular file form .tar, .tar.gz or .tar.bzip2
---------------------------------------------------------------------------In previous examples of extracting contetns from tar file we have extracted everything.
sometime we just need a specific file from tar file. in this example of unix tar command we
will extract a particular file from a tar archive.
stock_trader@system:~/test/new tar -jxvf trading.tar.bz2 equity
equity
its simple just specify name of file in this case its "equity". if your tar file is gzip one then
use "-z" that's it. You can also use combination of grep and find command with tar to get
more dynamic use.
How to extract group of file or directory from form .tar, .tar.gz or .tar.bzip2 in
UNIX
you can extract a group of file form .tar, .tar.gz or .tar.bzip2 in Unix by specifying a
matching pattern and using option "--wildcards". let's an example of tar command in unix
with --wildcards
stock_trader@system:~/test/new tar -jxvf trading.tar.bz2 --wildcards "s*"
stocks/
stocks/online_stock_exchanges.txt
In above example of UNIX tar command we are extracting all files or directory which names
starts with "s".

How to update existing tar file in Linux


You can also update or append new files in already created tar file. option"-r" is used for
that. Lets see an example of updatating tar file using tar command in UNIX:
stock_trader@system:~/test tar -cvf sample.tar equity currency
equity
currency
stock_trader@system:~/test tar -rvf sample.tar gold
gold
stock_trader@system:~/test tar -tvf sample.tar
-r--r--r-- stock_trader/Domain Users 0 2011-07-15 11:42 equity
-r--r--r-- stock_trader/Domain Users 221 2011-07-18 13:10 currency
-rw-r--r-- stock_trader/Domain Users

0 2011-07-18 13:30 gold

Apparently can not update compressed archives.if you try to do you will get error "tar:
Cannot update compressed archives"
Calculating size of tar file in UNIX
Some time its useful to know the size of tar file before creating it and you can get it by
using unix tar command as shown in below example:
stock_trader@system:~/test tar -cf - * | wc -c
20480
Size shown here is in KB and you can also calculate size for compressed tar file by using "z"
for gzip and "j" for bzip2
Linux interview questions - posted on June 27, 2013 at 16:25 PM by Kshipra Singh
1. Which account is created on Linux installation?
- With the installation of Linux, a super user account is created called as root.
2. Which daemon tracks events on your system?

- The syslogd daemon tracks the system information and saves it to specified log files.
3. Which command would you use if you want to remove the password assigned to
a group?
- gpasswd r removes the password from the group.
- Here, the gpasswd changes the password of the group and when it is accompanied by r,
the password gets removed.
4. You wish to print a file draft with 60 lines to a page. What command would you
use?
- The command that I would use is: pr -l60 draft
- The default page length when using pr is 66 lines.
- The -l option specifies a different length.
5. Which file would you examine to determine the levels of messages written to
system log files?
- kernel.h
6. You are logged on as a regular user. Without logging off and logging on as root,
you are required to create a new user account immediately. How would you do it?
- This can be achieved by issuing the su command.
- This will prompt you for the password of the root account.
- Providing the password, logs you in as root. Now, you can perform any administrative
duties. .
7. You are required to restore the file memo.ben. It was backed up in the tar file
MyBackup.tar. Which command would you use to do it?
- The command that we would use is: tar xf MyBackup.tar memo.ben
- It uses the x switch to extract a file.
8. What is partial backup?
- When you select only a portion of your file hierarchy or a single partition to back up, it is
called partial back up.
9. What is the fastest way to enter a series of commands from the command-line?
- Write the commands, each separated by a semi-colon. Press enter after the last
command.
- The semi-colon would inform the shell that multiple commands are being entered at the
command line, to be executed serially.
10. What are the qualities of soft links?

a.) Soft link files have different inode numbers than source file
b.) The soft link file will be of no use if original file is deleted.
c.) Soft links are not updated
d.) They can create links between directories
e.) They can cross file system boundaries
11. Differentiate between Cron and Anacron.
a.) Minimum granularity with Cron is minute while it is in days with Anacron.
b.) Cron job can be scheduled by any normal user while Anacron can be scheduled only by
the super user.
c.) Cron expects the system to be up and running while the Anacron doesnt expect the
system to be up and running all the time. In case of anacron if a job is scheduled and the
system is down that time, it will execute the job as soon as the system is up and running.
d.) Cron is ideal for servers while Anacron is ideal for desktops and laptops.
e. ) Cron should be used when you want a job to be executed at a particular hour and
minute while Anacron should be used in when the job can be executed irrespective of the
hour and minute.
12.) What is an INODE?
- It is a structure which has the description of all the files and pointers to the data blocks of
file stored in it.
- The information contained is file-size, access and modification time, permission and so on.
What is Linux and why is it so popular?
Answer - Linux is an operating system that uses UNIX like Operating system.......
Unix interview questions with answers
Discuss the mount and unmount system calls, What are the process states in Unix?, What is
use of sed command?, What is 'inode'?,What are the Unix system calls for I/O?, How are
devices represented in UNIX?, Brief about the directory representation in UNIX ......
What is LILO?
Answer - LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the
memory and start the Operating system.......
What is the difference between home directory and working directory?
Answer - Home directory is the default working directory when a user logs in. On the other
hand, working directory is the users current directory.......
What is the difference between internal and external commands?
Answer - Internal commands are commands that are already loaded in the system. They
can be executed any time and are independent.......
Explain the difference between a static library and a dynamic library.

Answer - Static libraries are loaded when the program is compiled and dynamically-linked
libraries are loaded in while......
What is LD_LIBRARY_PATH?
Answer - LD_LIBRARY_PATH is an environment variable. It is used for debugging a new
library or a non standard library.......
What is the file server in Linux server?
Answer - File server is used for file sharing. It enables the processes required fro
sharing.......
What is NFS? What is its purpose?
Answer - NFS is Network File system. It is a file system used for sharing of files over a
network.......
How do I send email with linux?
Answer - Email can be sent in Linux using the mail command. ......
Explain RPM (Red Hat Package Manager) features.
Answer - RPM is a package managing system (collection of tools to manage software
packages).......
What is Kernel? Explain the task it performs.
Answer - Kernel is used in UNIX like systems and is considered to be the heart of the
operating system.......
What is Linux Shell? What is Shell Script?
Answer - Linux shell is a user interface used for executing the commands. Shell is a
program the user......
What are Pipes? Explain use of pipes.
Answer - A pipe is a chain of processes so that output of one process (stdout) is fed an
input (stdin) to another.......
Explain trap command; shift Command, getopts command of linux.
Answer - Trap command: controls the action to be taken by the shell when a signal is
received. ......
What Stateless Linux server? What feature it offers?

Answer - A stateless Linux server is a centralized server in which no state exists on the
single workstations. ......
What does nslookup do? Explain its two modes.
Answer - Nslookup is used to find details related to a Domain name server. Details like IP
addresses of a machine, MX records,......
What is Bash Shell?
Answer - Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has
a combination of the C and Korn shell features. ......
Explain some Network-Monitoring Tools in Linux: ping, traceroute, tcpdump, ntop
Answer - Network monitoring tools are used to monitor the network, systems present on
the network, traffic etc.......
How does the linux file system work?
Answer - Linux file structure is a tree like structure. It starts from the root directory,
represented by '/', and then expands into sub-directories.......
What are the process states in Linux?
Answer - Process states in Linux.......
What is a zombie?
Answer - Zombie is a process state when the child dies before the parent process. In this
case the structural information of the process is still in the process table.......
Explain each system calls used for process management in linux.
Answer - System calls used for Process management......
Which command is used to check the number of files and disk space used and the
each users defined quota?
repquota command is used to check the status of the users quota along with the disk space
and number of files used. This command gives a summary of the users quota that how
much space and files are left for the user. Every user has a defined quota in Linux. This is
done mainly for the security, as some users have only limited access to files. This provides a
security to the files from unwanted access. The quota can be given to a single user or to a
group of users.
What is the name and path of the main system log?
By default the main system log is /var/log/messages. This file contains all the messages and
the script written by the user. By default all scripts are saved in this file. This is the standard

system log file, which contains messages from all system software, non-kernel boot issues,
and messages that go to 'dmesg'. dmesg is a system file that is written upon system boot.
How secured is Linux? Explain.
Security is the most important aspect of an operating system. Due to its unique
authentication module, Linux is considered as more secured than other operating systems.
Linux consists of PAM. PAM is Pluggable Authentication Modules. It provides a layer between
applications and actual authentication mechanism. It is a library of loadable modules which
are called by the application for authentication. It also allows the administrator to control
when a user can log in. All PAM applications are configured in the directory "/etc/pam.d" or
in a file "/etc/pam.conf". PAM is controlled using the configuration file or the configuration
directory.
Can Linux computer be made a router so that several machines may share a single
Internet connection? How?
Yes a Linux machine can be made a router. This is called "IP Masquerade." IP Masquerade is
a networking function in Linux similar to the one-to-many (1: Many) NAT (Network Address
Translation) servers found in many commercial firewalls and network routers. The IP
Masquerade feature allows other "internal" computers connected to this Linux box (via PPP,
Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows this
functionality even if the internal computers do not have IP addresses.
The IP masquerading can be done by the following steps:
1. The Linux PC must have an internet connection and a connection to LAN. Typically, the
Linux PC has two network interfaces-an Ethernet card for the LAN and a dial-up PPP
connection to the Internet (through an ISP).
2. All other systems on your LAN use the Linux PC as the default gateway for TCP/IP
networking. Use the same ISP-provided DNS addresses on all systems.
3. Enable IP forwarding in the kernel. By default the IP forwarding is not enabled. To ensure
that IP forwarding is enabled when you reboot your system, place this command in the
/etc/rc.d/rc.local file.
4. Run /sbin/iptables-the IP packet filter administration program-to set up the rules that
enable the Linux PC to masquerade for your LAN.
What is the minimum number of partitions you need to install Linux?
Minimum 2 partitions are needed for installing Linux. The one is / or root which contains all
the files and the other is swap. Linux file system is function specific which means that files
and folders are organized according to their functionality. For example, all executables are in
one folder, all devices in another, all libraries in another and so on. / or root is the base of
this file system. All the other folders are under this one. / can be consider as C: .Swap is a
partition that will be used as virtual memory. If there is no more available RAM a Linux
computer will use an area of the hard disk, called swap, to temporarily store data. In other
words it is a way of expanding your computers RAM.
Which command is used to review boot messages?

dmesg command is used to review boot messages. This command will display system
messages contained in the kernel ring buffer. We can use this command immediately after
booting to see boot messages. A ring buffer is a buffer of fixed size for which any new data
added to it overwrites the oldest data in it. Its basic syntax is
dmesg [options]
Invoking dmesg without any of its options causes it to write all the kernel messages to
standard output. This usually produces far too many lines to fit into the display screen all at
once, and thus only the final messages are visible. However, the output can be redirected to
the less command through the use of a pipe, thereby allowing the startup messages to be
viewed on one screen at a time
dmesg | less
Which utility is used to make automate rotation of a log?
logrotate command is used to make automate rotation of log.
Syntax of the command is:
logrotate [-dv] [-f|] [-s|] config_file+
It allows automatic rotation, compression, removal, and mailing of log files. This command
is mainly used for rotating and compressing log files. This job is done every day when a log
file becomes too large. This command can also be run by giving on command line. We can
done force rotation by giving f option with this command in command line. This command
is also used for mailing. We can give m option for mailing with this command. This option
takes two arguments one is subject and other is recipient name.
What are the partitions created on the mail server hard drive?
The main partitions are done firstly which are root, swap and boot partition. But for the mail
server three different partitions are also done which are as follows:
1. /var/spool- This is done so that if something goes wrong with the mail server or spool
than the output cannot overrun the file system.
2. /tmp- putting this on its own partition prevents any user item or software from
overrunning the system files.
3. /home- putting this on its own is useful for system upgrades or reinstalls. It allow not to
wipe off the /home hierarchy along with other areas.
What are the fields in the/etc/passwd file?
It contains all the information of the users who log into the system. It contains a list of the
system's accounts, giving for each account some useful information like user ID, group ID,
home directory, shell, etc. It should have general read permission as many utilities, like ls
use it to map user IDs to user names, but write access only for the superuser (root). The
main fields of /etc/passwd file are:
1. Username: It is used when user logs in. It should be between 1 and 32 characters in
length.
2. Password: An x character indicates that encrypted password is stored in /etc/shadow file.
3. User ID (UID): Each user must be assigned a user ID (UID). UID 0 (zero) is reserved for
root and UIDs 1-99 are reserved for other predefined accounts. Further UID 100-999 are
reserved by system for administrative and system accounts/groups.
4. Group ID (GID): The primary group ID (stored in /etc/group file)
5. User ID Info: The comment field. It allow you to add extra information about the users

such as user's full name, phone number etc. This field use by finger command.
6. Home directory: The absolute path to the directory the user will be in when they log in. If
this directory does not exists then users directory becomes /
7. Command/shell: The absolute path of a command or shell (/bin/bash). Typically, this is a
shell.
Which commands are used to set a processor-intensive job to use less CPU time?
nice command is used for changing priority of the jobs.
Syntax: nice [OPTION] [COMMAND [ARG]...]
Range of priority goes from -20 (highest priority) to 19 (lowest).Priority is given to a job so
that the most important job is executed first by the kernel and then the other least
important jobs. This takes less CPU times as the jobs are scheduled and are given priorities
so the CPU executes fast. The priority is given by numbers like -20 describe the highest
priority and 19 describe the least priority.
How to change window manager by editing your home directory?
/.xinitrc file allows changing the window manager we want to use when logging into X from
that account. The dot in the file name shows you that the file is a hidden file and doesn't
show when you do a normal directory listing. For setting a window manager we have to
save a command in this file. The syntax of command is: exec windowmanager.After this,
save the file. Next time when you run a startx a new window manager will open and become
default. The commands for starting some popular window managers and desktop
environments are:
-KDE = startkde
-Gnome = gnome-session
-Blackbox = blackbox
-FVWM = fvwm
-Window Maker = wmaker
-IceWM = icewm
How documentation of an application is stored?
When a new application is installed its documentation is also installed. This documentation is
stored under the directory named for application. For example if my application name is
App1 then the path of the documentation will be /user/doc/App1. It contains all the
information about the application. It contains date of creating application, name of
application and other important module of the application. We can get the basic information
of application from the documentation.
How shadow passwords are given?
pwconv command is used for giving shadow passwords. Shadow passwords are given for
better system security. The pwconv command creates the file /etc/shadow and changes all
passwords to x in the /etc/passwd file. First, entries in the shadowed file which don't exist
in the main file are removed. Then, shadowed entries which don't have `x' as the password
in the main file are updated. Any missing shadowed entries are added. Finally, passwords in
the main file are replaced with `x'. These programs can be used for initial conversion as well
to update the shadowed file if the main file is edited by hand.

How do you create a new user account?


useradd command is used for creating a new user account. When invoked without the
-D option, the useradd command creates a new user account using the values specified on
the command line and the default values from the system. The new user account will be
entered into the system files as needed, and initial files copied, depending on the command
line options. This command uses the system default as home directory. If m option is given
then the home directory is made.
Which password package is installed for the security of central password?
Shadow password packages are used for security of central passwords. Security is the most
important aspect of every operating system. When this package is not installed the user
information including passwords is stored in the /etc/passwd file. The password is stored in
an encoded format. These encoded forms can be easily identified by the System crackers by
randomly encoding the passwords from dictionaries. The Shadow Package solves the
problem by relocating the passwords to another file (usually /etc/shadow). The /etc/shadow
file is set so that it cannot be read by just anyone. Only root will be able to read and write
to the /etc/shadow file.
Which shell do you assign to a POP3 mail-only account?
POP3 mail only account is assigned to the /bin/false shell. However, assigning bash shell to
a POP3 mail only gives user login access, which is avoided. /bin/nologin can also be used.
This shell is provided to the user when we dont want to give shell access to the user. The
user cannot access the shell and it reject shell login on the server like on telnet. It is mainly
for the security of the shells. POP3 is basically used for downloading mail to mail program.
So for illegal downloading of emails on the shell this account is assigned to the /bin/false
shell or /bin/nologin. These both shells are same they both do the same work of rejecting
the user login to the shell. The main difference between these two shells is that false shell
shows the incorrect code and any unusual coding when user login with it. But the nologin
shell simply tells that no such account is available. So nologin shell is used mostly in Linux.
Which daemon is responsible for tracking events on Linux system?
syslogd is responsible for tracking system information and save it to the desired log files. It
provides two system utilities which provide system logging and kernel message trapping.
Internet and UNIX domain sockets support enable this utility package to support both local
and remote logging. Every logged message contains at least a time and a hostname field,
normally a program name field, too. So to track these information this daemon is used.
syslogd mainly reacts to the set of signals given by the user. These are the signals given to
syslogd: SIGHUP: This lets syslogd perform a re-initialization. All open files are closed, the
configuration file (default is /etc/syslog.conf) will be reread and the syslog facility is started
again. SIGTERM: The syslogd will die. SIGINT, SIGQUIT: If debugging is enabled these are
ignored, otherwise syslogd will die. SIGUSR1: Switch debugging on/off. This option can only
be used if syslogd is started with the - d debug option. SIGCHLD: Wait for Childs if some
were born, because of waiting messages.
Which daemon is used for scheduling of the commands?

The crontab command is used for scheduling of the commands to run at a later time.
SYNTAX
crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }
Options
-l List - display the current crontab entries.
-r Remove the current crontab.
-e Edit the current crontab using the editor specified by the VISUAL or EDITOR environment
variables.
When user exits from the editor, the modified crontab will be installed automatically. Each
user can have their own crontab, and though these are files in /var, they are not intended to
be edited directly. If the u option is given than the crontab gives the name of the user
whose crontab is to be tweaked. If it is given without this then it will display the crontab of
the user who is executing the command.
How environment variable is set so that the file permission can be automatically
set to the newly created files?
umask command is used to set file permission on newly created files automatically.
Syntax
umask [-p] [-S] [mode]
It is represented in octal numbers. We can simply use this command without arguments to
see the current file permissions. To change the permissions, mode is given in the
arguments. The default umask used for normal user is 0002. The default umask for the root
user is 0022. For calculating the original values, the values shown by the umask must be
subtracted by the default values. It is mainly used for masking of the file and directory
permission. The /etc/profile script is where the umask command is usually set for all users.
The S option can be used to see the current default permissions displayed in the alpha
symbolic format.
For example, umask 022 ensures that new files will have at most 755 permissions (777
NAND 022).
The permissions can be calculated by taking the NAND of original value with the default
values of files and directories.
Linux is an open-source operating system. It has gained immense popularity through the
years, setting the bar for ease-of-usability, high-grade security features, advanced shell
scripting terminals, and free to users. Consequently, these great features of Linux have
made the hiring process more competitive than ever. The good news is, technical questions
asked during phone interviews and even face-to-face interviews tend to be fairly
predictable. Employers rarely ever go into detailed technical scenarios. Even better, you will
encounter many of the same technical questions at almost all interviews you attend. Read
on to see the most commonly asked questions and answers at a Linux interview.
If youre new to Linux, heres an introductory course to setup, manage, and customize your
own Linux desktop.

Lets start with some basic questions that might not necessarily be asked (because theyre
too easy) but are essential basics everyone interested in Linux needs to know.
What is the core of Linux Operating System?
The core of the Linux operating system is Kernel. It is broken down into Shell, Command,
Script, and Terminal. Shell is a command Line Interpreter, Command is user Instruction to
Computer, Script is collection of commands stored in a file, and Terminal is a command Line
Interface.
What is the basic difference between UNIX and Linux Operating System?
Linux is free and open-source software (allowing programmers to program with Linux not
around it), the kernel of which is created by Linus Torvalds and community. UNIX, on the
other hand, is UNIX is copyrighted name only big companies are allowed to use the UNIX
copyright and name, so IBM AIX and Sun Solaris and HP-UX all are UNIX operating systems.
What is an INODE?
All files have its description stored in a structure called inode. The inode contains info about
the file-size, access and modification time, permission and so on. In addition to descriptions
about the file, the inode contains pointers to the data blocks of the file.
State the syntax of any Linux command.
The correct syntax of Linux command is Command [options] [arguments]. Master the Linux
command line with this guide.
Now lets move on to the meatier questions that are more likely to be asked:
What is the difference between TCP and UDP?
The basic difference is that TCP establishes a connection before sending data and this allows
it to control the dataflow and guarantee that all packets get delivered. UDP simply chucks
datagrams onto the wire and if some get lost or arrive in bad order theres no way to
request a resend. However UDP has low network overhead so some services such as DNS
resolution, SNMP, DHCP, RIP and VOIP use UDP for its speed and any errors are usually
dealt with on the application layer rather than network layer.
How does DNS resolution work?
A client application requests an IP address from the name server usually by connecting to
UDP port 53. The name server will attempt to resolve the FQDN based on its resolver
library, which may contain authoritative information about the host requested or cached
data about that name from an earlier query. If the name server does not already have the
answer, it will turn to root name servers to determine the authoritative for the FQDN in
question. Then, with that information, it will query the authoritative name servers for that
name to determine the IP address.
What is an MX record?

An MX record numerically ranks the mail servers you would prefer to receive email for a
domain. The MX record with the lowest number is preferred over the others, but you can set
multiple email servers with the same value for simple load balancing.
Please describe the Linux boot-up sequence.
There are seven steps to the boot-up sequence. 1) BIOS (basic input/output system)
executes the MBR where Boot Loader sits, 2) MBR- Master boot reads Kernel into memory,
3) GRUB (Grand Unified Bootloader) Kernel starts Init process, 4) Kernel Kernel executes
the /sbin/init program. Init reads inittab, executes rc.sysinit, 5) Init the rc script than
starts services to reach the default run level and 6) Run level programs these programs
are executed from /etc/rc.d/rc*.dl/
How do you search for a pattern and then replace it in an entire file?
You use Sed, or in Vi editor, the search uses character s slash the pattern to be searched,
slash the pattern to replace it with, slash g which stands for entire file.
How do you list and flush all IPtables?
First you use the L switch to view all the currently present rules and then F to flush them.
What is a shell? What are their names?
The shell is the part of the system with which the user interacts. A Unix shell interprets
commands such as pwd, cd or traceroute and sends the proper instructions to the
actual operating system itself. The shells currently available areAns SH, BASH, CSH, TCSH,
NOLOGIN, KSH. Other functions of a shell include scripting capability, path memory,
multitasking, and file handling.
What is a zombie?
Cheeky answers get bonus points for this one. But in the Linux world, a zombie process is
the process output of ps by the presence of Z in the STAT column. Zombies are
essentially the premature processes whose mature parent processes died without reaping its
children. Note that zombies cant be killed with the usual kill signal.
We hope this questions have helped you in your Linux interview preparation. If youd like a
more advanced tutorial on Linux and running Linux administration, learn to run Linux
servers from scratch here.
linux interview questions and answers for experienced

* To display a list of all manual pages containing the keyword "date", what command would
you type?

* What command will display the first several lines of a file called "junk"?
== Users and permissions practicum ==
* Rig it so everything in the folder gets deleted tonight at 10pm. Every night at 10pm.
== Local security ==
* How do you feel about `sudo`?
* What's the difference between `telnet` and `ssh`? What's a good use for each?
* How do you ensure your users have hard-to-guess passwords?
== Filesystem ==
* What is the difference between a symbolic and hard link? When would you use each?
* I have a file named `-fr`. How do I get rid of it?
* Why did I just ask that question?
* To partition or not? How?
* What are RAID 0, 1, 5, 0+1? What level would you use for a web server and why? A
database server?
== `/etc` ==
* `ls -l /etc`. What is all this stuff?
* You added a line to `/etc/aliases`, but it doesn't seem to be working. Why?
* You've created a `zope` user to run Zope under. How do you secure it so someone doesn't
guess its password, log in with it, and mess with stuff?
* Bring up `/etc/passwd`. What is all this junk?
* What are shadow passwords?
== Processes ==
* How many processes are running on your machine right now?
== Shells ==
* Name as many shells as you can.
* What's your favorite shell? Why?
* Write a shell script to append "snork" to the file "test" but only if "test" already exists.
* A user performed a `cd; chmod 644 .` before logging out. What problem occurs when he
logs in the next time, and what level of privilege is required to correct the problem?
== Startup ==
* Describe the boot process of your favorite Linux in as much detail as you can.
* What are runlevels?
== Social ==
* Describe an experience you had with a difficult user.
* How do you keep up with current tools and practices?
* How did you document your work at your last job so someone else could pick up where
you left off?
== Totally miscellaneous ==
* When debugging a core in gdb, what does the command `bt` give: core memory, heap
usage, or calling stack?
* A user complains the web site is slow. What do you do?
== Apache ==
* How do you rig Apache to start up on boot?
* Apache doesn't start up on boot, and the thing above checks out okay. How do you track
down the problem?
=============================================
To display a list of all manual pages containing the keyword "date", what command would
you type?

Code:
man -k date
man -f date
Linux / UNIX: Getting help with man page
* What command will display the first several lines of a file called "junk"?
Code:
head junk
man head
== Users and permissions practicum ==
* Rig it so everything in the folder gets deleted tonight at 10pm. Every night at 10pm.
Set cronjob, see How do I add jobs to cron under Linux or UNIX oses?
== Local security ==
* How do you feel about `sudo`?
sudo allows a permitted user to execute a command as the superuser or another user. sudo
is much better than su and you don't have to share root password with other users/admin.
Linux sudo Configuration
* What's the difference between `telnet` and `ssh`? What's a good use for each?
TELNET, by default, does not encrypt any data sent over the connection (including
password, and so it is often practical to eavesdrop on the communications and use the
password later for malicious purposes;
SSH by default encrypt password and traffic. SSH is recommended for all use.
* How do you ensure your users have hard-to-guess passwords?
Set password policy, see
Howto: Protect account against a password cracking attack
Linux check passwords against a dictionary attack
Linux Password Cracking: Explain unshadow and john commands ( john the ripper tool )
== Filesystem ==
* What is the difference between a symbolic and hard link? When would you use each?
How to: Linux / UNIX create soft link with ln command
Understanding UNIX / Linux symbolic (soft) and hard links
* I have a file named `-fr`. How do I get rid of it?
Code:
rm -- -fr
rm \-rf
How to: Linux / UNIX Delete or Remove Files With Inode Number
* Why did I just ask that question?

For testing UNIX concepts and command line args.


* To partition or not? How?
Sure. See The importance of Linux partitions
* What are RAID 0, 1, 5, 0+1? What level would you use for a web server and why? A
database server?
See level @ What are the different RAID levels for Linux / UNIX and Windows Server?
More about RAID - Can RAID Act As The Reliable BACKUP Solution For Linux / UNIX /
Windows Server?
Linux Check The Health of Adaptec RAID array
== `/etc` ==
* `ls -l /etc`. What is all this stuff?
See, Linux / UNIX - Display the permissions of a file
* You added a line to `/etc/aliases`, but it doesn't seem to be working. Why?
Restart sendmail so that file get updated. The program "newaliases" must be run after this
file is updated for any changes to show through to sendmail / postfix.
Code:
newaliases
* You've created a `zope` user to run Zope under. How do you secure it so someone doesn't
guess its password, log in with it, and mess with stuff?
Deny login access to zope and set shell to /sbin/nologin. There are other ways too...
* Bring up `/etc/passwd`. What is all this junk?
See, Understanding /etc/passwd file format
* What are shadow passwords?
/etc/shadow file stores actual password in encrypted format for user's account with
additional properties related to user password
Understanding /etc/ shadow file
== Processes ==
* How many processes are running on your machine right now?
Code:
top
atop
ps -e
ps aux
ps aux | wc -l
man ps
== Shells ==
* Name as many shells as you can.
Bourne shell (sh)
Almquist shell (ash)

Debian Almquist shell (dash)


Bourne-Again shell (bash)
Friendly interactive shell (fish)
Korn shell (ksh)
C shell (csh)
TENEX C shell (tcsh)
Es shell (e
esh (Unix) Easy Shell
rc shell (rc) - shell for Plan 9 and Unix
runscript The initial shell interpreter used to process startup scripts in Gentoo
scsh (Scheme Shell)
Stand-alone Shell (sash)
Z shell (zsh)
* What's your favorite shell? Why?
bash - it rocks and feature rich.
* Write a shell script to append "snork" to the file "test" but only if "test" already exists.
Code:
[ -f test ] && echo "snork" >> test ||:
* A user performed a `cd; chmod 644 .` before logging out. What problem occurs when he
logs in the next time, and what level of privilege is required to correct the problem?
User will not able to login. A root user can this problem by resting permission
cmod perm /home/user
. is current directory
.. parent directory
== Startup ==
* Describe the boot process of your favorite Linux in as much detail as you can.
See redhat or any other distro doc
* What are runlevels?
The term runlevel refers to a mode of operation in one of the computer operating systems
that implement Unix System V-style initialization. Conventionally, seven runlevels exist,
numbered from zero to six, though up to ten, from zero to nine, may be used.
Code:
man init
man runlevel
== Social ==
* Describe an experience you had with a difficult user.
* How do you keep up with current tools and practices?
* How did you document your work at your last job so someone else could pick up where
you left off?
Use our social skillz
== Totally miscellaneous ==

* When debugging a core in gdb, what does the command `bt` give: core memory, heap
usage, or calling stack?
Code:
man gdb
Read gdb page
* A user complains the web site is slow. What do you do?
Ask user to upgrade internet connection. If using windows ask to reboot windows .. LOL just
kidding, google for slow apache problem. There could be zillions of causes
== Apache ==
* How do you rig Apache to start up on boot?
Code:
chkconfig httpd on
* Apache doesn't start up on boot, and the thing above checks out okay. How do you track
down the problem?
Code:
chkconfig httpd on
httpd -t
service httpd on
netstat -tulpn | grep 80
tail -f /var/log/httpd/access_log
tail -f /var/log/httpd/error_log
`
#########################################################
#########################################################
Here is a listing of Linux / Unix Technical Interview Questions & Answers for experienced IT
professionals as well as fresh engineering graduates. These questions can be attempted by
anyone focusing on Linux Development and Systems programming. If you liked any
question, please endorse it by liking it or share it with your friends.
1. Each process has unique
a) fd table
b) file table
c) inode table
d) data block table
View Answer
2. File descriptor table indexes which kernel structure?
a) struct file
b) strruct fs_struct
c) files_struct
d) struct inode
View Answer
3. What is the default number of files open per user process?
a) 0

b) 1
c) 2
d) 3
View Answer
4. The file system information is stored in
a) Boot block
b) Super Block
c) Inode Table
d) Data Block
View Answer
5. Switch table is used by
a) device special file
b) directory file
c) fifo
d) link file.
View Answer
6. What is the use of fcntl function?
a) locking a file
b) reading the file descriptor flag
c) changing the file status flag
d) all the above
View Answer
7. Which function can be used instead of the dup2 to duplicate the file descriptor?
a) read()
b) open()
c) stat()
d) fcntl()
View Answer
8. printf() uses which system call
a) open
b) read
c) write
d) close
View Answer
9. read() system call on success returns
a) 0
b) -1
c) number of character
d) none
View Answer
10. Which system call is used to create a hard link?
a) hardlink
b) link
c) symlink
d) ln
View Answer
11. namei() is
a) ANSI C library function
b) C library function
c) System call
d) kernel routine
View Answer

12. dup2(1,0)
a) closes the stdout and copies the stdin descriptor to stdout
b) closes the stdin and copies the stdout descriptor to stdin
c) will produce compilation error
d) None of the above
View Answer
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
A new article in this section (Linux Interview) will be posted on every weekend. The
initiative taken by Tecmint is first of its kind among other Linux Dedicated websites,
along with quality and unique articles.
We will start with Basic Linux Interview Question and will go advance article by article,
for which your response is highly appreciated, which put us on a higher note.
Q.1: What is the core of Linux Operating System?
o
Shell
o
Kernel
o
Command
o
Script
o
Terminal
Answer : Kernel is the core of Linux Operating System. Shell is a command Line
Interpreter, Command is user Instruction to Computer, Script is collection of commands
stored in a file and Terminal is a command Line Interface
Q.2: What Linus Torvalds Created?
o
Fedora
o
Slackware
o
Debian
o
Gentoo
o
Linux
Answer : Linux Torvalds created Linux, which is the kernel (heart) of all of the above
Operating System and all other Linux Operating System.
Q.3: Torvalds, Wrote most of the Linux Kernel in C++ programming Language, do you
agree?
Answer : No! Linux Kernel contains 12,020,528 Lines of codes out of which 2,151,595 Lines
are comments. So remaining 9,868,933 lines are codes and out of 9,868,933 Lines of codes
7,896,318 are written in C Programming Language.
The remaining Lines of code 1,972,615 is written in C++, Assembly, Perl, Shell Script,
Python, Bash Script, HTML, awk, yacc, lex, sed, etc.
Note : The Number of Lines of codes varies on daily basis and an average of more than
3,509 lines are being added to Kernel.
Q.4: Linux initially was developed for intel X86 architecture but has been ported to other
hardware platform than any other Operating System. Do you agree?.
Answer : Yes, I do agree. Linux was written for x86 machine, and has been ported to all
kind of platform. Todays more than 90% of supercomputers are using Linux. Linux made a

very promising future in mobile phone, Tablets. In-fact we are surrounded by Linux in
remote controls, space science, Research, Web, Desktop Computing. The list is endless.
Q.5: Is it legal to edit Linux Kernel?
Answer : Yes, Kernel is released under General Public Licence (GPL), and anyone can edit
Linux Kernel to the extent permitted under GPL. Linux Kernel comes under the category of
Free and Open Source Software (FOSS).
Q.6: What is the basic difference between UNIX and Linux Operating System.
Answer : Linux Operating System is Free and Open Source Software, the kernel of which is
created by Linus Torvalds and community. Well you can not say UNIX Operating System
doesnt comes under the category of Free and Open Source Software, BSD, is a variant of
UNIX which comes under the category of FOSS. Moreover Big companies like Apple, IBM,
Oracle, HP, etc. are contributing to UNIX Kernel.
Q. 7: Choose the odd one out.
o
HP-UX
o
AIX
o
OSX
o
Slackware
o
Solaris
Answer : Slackware is the odd in the above list. HP-UX, AIX, OSX, Solaris are developed by
HP, IBM, APPLE, Oracle respectively and all are UNIX variant. Slackware is a Linux Operating
System.
Q.8: Is Linux Operating system Virus free?
Answer : No! There doesnt exist any Operating System on this earth that is virus free.
However Linux is known to have least number of Viruses, till date, yes even less than UNIX
OS. Linux has had about 60-100 viruses listed till date. None of them actively spreading
nowadays. A rough estimate of UNIX viruses is between 85 -120 viruses reported till date.
Q.9: Linux is which kind of Operating System?
o
Multi User
o
Multi Tasking
o
Multi Process
o
All of the above
o
None of the above
Answer : All of the Above. Linux is an Operating System which supports Multi User, Running
a Number of Processes performing different tasks simultaneously.
Q.10: Syntax of any Linux command is:
o
command [options] [arguments]
o
command options [arguments]
o
command [options] [arguments]
o
command options arguments
Answer : The correct Syntax of Linux Command is Command [options] [arguments].
Q.11:
o
o
o
o

Choose the odd one out.


Vi
vim
cd
nano

Answer : The odd one in the above list is cd. Vi, vim and nano are editors which is useful in
editing files, while cd command is used for changing directory.
Linux interview questions
What is Kernel? Explain the task it performs.
Kernel is used in UNIX like systems and is considered to be the heart of the operating
system. It is responsible for communication between hardware and software components. It
is primarily used for managing the systems resources as well.
Kernel Activities:
The Kernel task manager allows tasks to run concurrently.
Managing the computer resources: Kernel allows the other programs to run and use the
resources
Resources include I/O devices, CPU, memory.
Kernel is responsible for Process management. It allows multiple processes to run
simultaneously allowing user to multitask.
Kernel has an access to the systems memory and allows the processes to access the
memory when required.
Processes may also need to access the devices attached to the system. Kernel assists the
processes in doing so.
For the processes to access and make use of these services, system calls are used.
What is Linux Shell? What is Shell Script?
Linux shell is a user interface used for executing the commands. Shell is a program the user
uses for executing the commands. In UNIX, any program can be the users shell. Shell
categories in Linux are:
Bourne shell compatible, C shell compatible, nontraditional, and historical
A shell script, as the name suggests, is a script written for the shell. Script here means a
programming language used to control the application. The shell script allows different
commands entered in the shell to be executed. Shell script is easy to debug, quicker as
compared to writing big programs. However the execution speed is slow because it launches
a new process for every shell command executed. Examples of commands are cp, cn, cd.

What are Pipes? Explain uses of pipes.


A pipe is a chain of processes so that output of one process (stdout) is fed an input (stdin)
to another. UNIX shell has a special syntax for creation of pipelines. The commands are
written in sequence separated by |. Different filters are used for Pipes like AWK, GREP.
e.g. sort file | lpr ( sort the file and send it to printer)
Uses of Pipe
Several powerful functions can be in a single statement
Streams of processes can be redirected to user specified locations using >
Explain trap command; shift Command, getopts command of linux.
Trap command: controls the action to be taken by the shell when a signal is received.
Trap [OPTIONS] [ [arg] signspec..]
Arg is the action to be taken or executed on receiving a signal specified in signspec.
E.g. trap rm $FILE; exit // exit (signal) and remove file (action)
Shift Command: Using shift command, command line arguments can be accessed. The
command causes the positional parameters shift to the left. Shift [n] where n defaults to 1.
It is useful when several parameters need to be tested.
Getopts command: this command is used to parse arguments passed. It examines the
next command line argument and determines whether it is a valid option
Getopts {optstring} {variable1}. Here, optsring contains letters to be recognized if a letter
is followed by a colon, an argument should be specified. E.g (whether the argument begins
with a minus sign and is followed by any single letter contained inside options ) If not,
diagnostic messages are shown. It is usually executed inside a loop.
What Stateless Linux server? What feature it offers?
A stateless Linux server is a centralized server in which no state exists on the single
workstations. There may be scenarios when a state of a partilcuar system is meaningful (A
snap shot is taken then) and the user wants all the other machines to be in that state. This
is where the stateless Linux server comes into picture.
Features:

It stores the prototypes of every machine


It stores snapshots taken for those systems
It stores home directories for those systems
Uses LDAP containing information of all systems to assist in finding out which snapshot (of
state) should be running on which system.
What does nslookup do? Explain its two modes.
Nslookup is used to find details related to a Domain name server. Details like IP addresses
of a machine, MX records, servers etc. It sends a domain name query packet to the
corresponding DNS.
Nslookup has two modes. Interactive and non interactive. Interactive mode allows the user
to interact by querying information about different hosts and domains.
Non interactive mode is used to fetch information about the specified host or domain.
Interactive mode:
Nslookup [options] [server]
What is Bash Shell?
Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a
combination of the C and Korn shell features. Bash shell is not portable. any Bash-specific
feature will not function on a system using the Bourne shell or one of its replacements,
unless bash is installed as a secondary shell and the script begins with #!/bin/bash. It
supports regular and expressions. When bash script starts, it executes commands of
different scripts.
Explain Some Network-Monitoring Tools in Linux: ping, traceroute, tcpdump, ntop
Network monitoring tools are used to monitor the network, systems present on the network,
traffic etc.
Ping: Ping command is used to check if the system is in the network or not. To check if the
host is operating.
E.g. ping ip_address
When the command is executed, it returns a detailed summary of the host. Packets
received, lost by estimating the round trip time.

sent,

Traceroute : the command is used to trace the path taken by the packet across a network.
Tracing the path here means finding out the hosts visited by the packet to reach its
destination. This information is useful in debugging. Roundtrip time in ms is shown for every
visit to a host.
Tcpdump: commonly used to monitor network traffic. Tcdump captures and displays packet
headers and matching them against criteria or all. It interprets Boolean operators and
accepts host names, ip address, network names as arguments.
Ntop : Network top shows the network usage. It displays summary of network usage by
machines on the network in a format as of UNIX top utility. It can also be run in web mode,
which allows the display to be browsed with a web browser. It can display network traffic
statistics, identify host etc. Interfaces are available to view such information.
Explain file system of linux. The root "/" filesystem, /usr filesystem, /var
filesystem, /home filesystem, /proc filesystem.
Root "/" file system: The kernel needs a root file system to mount at start up. The root
file system is generally small and should not be changed often as it may interrupt in
booting. The root directory usually does not have the critical files. Instead sub directories
are created. E.g. /bin (commands needed during bootup), /etc (config files) , /lib(shared
libraries).
/usr filesystem : this file system is generally large as it contains the executable files to be
shared amongst different machines. Files are usually the ones installed while installing
Linux. This makes it possible to update the system from a new version of the distribution, or
even a completely new distribution, without having to install all programs again. Sub
directories include /bin, /include, /lib, /local (for local executables)
/var filesystem : this file system is specific to local systems. It is called as var because the
data keeps changing. The sub directories include /cache/man (A cache for man pages),
/games (any variable data belong to games), /lib (files that change), /log (log from different
programs), /tmp (for temporary files)
/home filesystem: - this file system differs from host to host. User specific configuration
files for applications are stored in the user's home directory in a file. UNIX creates
directories for all users directory. E.g /home/my_name. Once the user is logged in ; he is
placed in his home directory.
/proc filesystem : this file system does not exist on the hard disk. It is created by the
kernel in its memory to provide information about the system. This information is usually
about the processes. Contains a hierarchy of special files which represent the current state
of the kernel .Few of the Directories include /1 (directory with information about process
num 1, where 1 is the identification number), /cpuinfo (information about cpu), /devices
(information about devices installed), /filesystem (file systems configured), /net
(information about network protocols), /mem (memory usage)

What are the process states in Linux?


Process states in Linux:
Running: Process is either running or ready to run
Interruptible: a Blocked state of a process and waiting for an event or signal from another
process
Uninterruptible: - a blocked state. Process waits for a hardware condition and cannot
handle any signal
Stopped: Process is stopped or halted and can be restarted by some other process
Zombie: process terminated, but information is still there in the process table.

What is a zombie?
Zombie is a process state when the child dies before the parent process. In this case the
structural information of the process is still in the process table. Since this process is not
alive, it cannot react to signals. Zombie state can finish when the parent dies. All resources
of the zombie state process are cleared by the kernel

Explain each system calls used for process management in linux.


System calls used for Process management:
Fork ():- Used to create a new process
Exec ():- Execute a new program
Wait ():- wait until the process finishes execution
Exit ():- Exit from the process
Getpid():- get the unique process id of the process
Getppid():- get the parent process unique id
Nice ():- to bias the existing property of process

Common Interview Questions

"Tell me about yourself" Be prepared to tell about your education and


professional achievements and professional goals. Then briefly describe your
qualifications for the job and the contributions you could make to the organization.

What made you apply for this position? "Why do you want to work
here?"
Be prepared to answer this clearly and with enthusiasm. Show what you know
about this organization or library through your own research.

How did you hear about this job opening?


Your answer here reveals what journals and listservs you read.

Why are you leaving your present job? (or, Why did you leave your last
job?)
Big question. If things have not gone well or you have experienced personality
conflicts, you want to be honest, but dont denigrate the previous employer or
person at issue. Keep your answer simple with explanations such as The job just
wasnt the right fit for me, and explain in a neutral, objective way whatever must
be explained. You do not need to go on at length about a bad situation. If you are
moving for family reasons or personal reasons, this question is easier to answer,
and these reasons do you no harm.
What is important to you in a job? What things do you look for in an
organization?
Think about this ahead of time so you are ready. Perhaps you greatly enjoy working
with knowledgeable people, having mentors, or jobs that offer you growth
opportunities, or organizations that are flexible.

Can you give me an example of your ability to manage or supervise


others?

This is a difficult question for anyone who hasnt had the opportunity to supervise.
If you have the opportunity presented to you, its always a good idea to take on this
challenge if you plan to move up in your career. Perhaps you have supervised workstudy students or pages, or managed people in an organization outside the library
world.

"What areas would you need to improve on for this position?" Be positive;
turn a weakness into a strength. For example, you might say: "I often worry too
much over my work. Sometimes I work late to make sure the job is done well." If
there are skills or new content you would need to learn, it is ok to be honest, but
try to make it sound like it wouldn't take very long to get up to speed in the specific
areas.

"What strengths do you bring to this job?" Be prepared to elaborate on your


strengths.

"Do you prefer to work by yourself or with others?" The ideal answer is one
of flexibility. However, be honest. Give examples of how you have worked in both
situations.

"What are your career goals?" or "What are your future plans" The
interviewer wants to know if your plans and the library's are compatible. Let
him/her know that you are ambitious enough to plan ahead, but leave the
impression that the job in question is perfectly acceptable to you, and that you
need this experience in preparation for your future plans.

"What do you like about libraries (librarianship) or being a librarian?" Try


not to respond that you like reading books. Most of us like to read books, and the
any library job will require much more of you. Unless you are seeking a job that
requires you read eight hours a day, you should have a good idea of why you enjoy
the library culture, library work or work in the information industry.

"Tell us about a difficult patron or coworker and how you handled the
situation" Have a situation in mind. If there has been a problem in the

organization that is interviewing you, it may become apparent to you here. They
may pitch you a question that sounds hypothetical, but in fact they are seeking to
know how you would handle this problematic situation.

"Tell us about a major contribution you made in your previous job" Be able
to enthusiastically tell about some contribution.

Other questions may include topics such as questions about your undergraduate
major, the work you performed in previous jobs, specific knowledge about the job
you would be assuming, and trend questions about the library field.

Your qualifications:

What qualifications do you have that relate to the position?


What new skills or capabilities have you developed recently?
Give me an example from a previous job where you've shown initiative
What is important to you in a job?
What motivates you in your work?

Your career goals:

What would you like to be doing five years from now?


What do you expect from this job?
Do you have a location preference?
Can you travel?
What hours can you work?

Questions for the Interviewer

Prepare five good questions (at least), although you may not have time to ask them
all. Ask questions concerning the job, the library or organization, the industry or the
profession.

Your questions should indicate your interest in these subjects and that you have
read and thought about them.

Don't ask questions that raise warning flags. For example, asking "Would I really
have to work weekends?" may imply that you are not available for weekend
assignments or would do it grudgingly. If you are available, rephrase your
question. Also, avoid initiating questions about compensation (pay, vacations) or
tuition reimbursements unless you have an appointment with the
personnel/benefits officer. You might seem more interested in paychecks or
time-off than the actual job.

Dont ask questions about only one topic. You may be perceived as onedimensional.

Clarify. It's ok to ask a question to clarify something the interviewer said. Just
make sure you were listening the first time. Asking someone to clarify a point
makes sense. Asking someone to re-explain an entire subject gives the
impression that you have problems listening or comprehending.

Sample Questions You Could Ask

"What is a typical day like here?"


"To whom does this position report?"
"How will my performance be evaluated?"
"How often are performance reviews given? By whom?"
"What are the opportunities for advancement?"
"Does your organization encourage its employees to pursue additional education
or professional development?"
"What is the reputation of the library on the campus (for academic positions) or
in the community?"
"Do the faculty welcome working with the librarians?"
Which parts of your community are your most active users?
"How would you describe your organization's personality and management
style?"

University of Indiana Bloomington has a great set of typical job questions you might
be asked: http://indylaw.indiana.edu/career/interview.htm

Some material above I sadapted from a handout from Hallmark Corporation and revised by Chris Le
Beau, January 2006.

Вам также может понравиться