Академический Документы
Профессиональный Документы
Культура Документы
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.
8. How do you set environment variable which will be accessible form sub shell?
By using export
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
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:
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
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
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
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".
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.
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?
* 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
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.
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 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
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.
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.
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.
"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.
"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:
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.
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.