- What would you use to view contents of a large error log file?
A. tail -10 file_name ( last 10 rows)
- How do you check for processes started by user 'pat'?
A. ps -fu pat (-f -full_format u -user_name )
- What is the difference between an argument and an option (or switch)?
- An argument is what the command should act on: it could be a filename,
directory or name. An option is specified when you want to request additional
information over and above the basic information each command supplies.
- What is the difference between a soft link and a hard link?
A symbolic (soft) linked file and the targeted file can be located on the same or different file system while for a hard link they must be located on the same file system.
- Explain iostat, vmstat and netstat.
iostat reports on terminal, disk and tape I/O activity.
vmstat reports on virtual memory statistics for processes, disk, tape and CPU activity. netstat reports on the contents of network data structures.
- What is the main advantage of creating links to a file instead of copies of the file?
The main advantage is not really that it saves disk space (though it does that too) but, rather, that a change of permissions on the file is applied to all the link access points. The link will show permissions of lrwxrwxrwx but that is for the link itself and not the access to the file to which the link points. Thus if you want to change the permissions for a command, such as su, you only have to do it on the original. With copies you have to find all of the copies and change permission on each of the copies.
- How would you change all occurrences of a value using VI?
%s/(old value)/(new value)/g
- Give two UNIX kernel parameters that effect an Oracle install.
SHMMAX & SHMMNI
- How do you install Oracle software on UNIX?
Basically, set up disks, kernel parameters, and run orainst.
- Explain the difference between SIGTERM and SIGKILL
SIGTERM asks the application to terminate in a polite way, it warns about the pending closure and asks the app to finish whatever it is doing. SIGKILL will kill the process no matter what. This is telling the application that it will be shut down no matter what.
- Explain the difference between SIGHUP, SIGUSR1 and SIGUSR2.
Those are application specific and therefore are not defined on the OS level.
- On a fresh install, why does Apache have three config files - srm.conf, access.conf and httpd.conf?
The first two are remnants from the NCSA times, and generally you should be ok if you delete the first two, and stick with httpd.conf.
- What does apachectl graceful do?
It sends a SIGUSR1 for a restart, and starts the apache server if it’s not running.
- What is the major advantage of a hash table?
Answer: The major advantage of a hash table is its speed. Because the hash function is to take a range of key values and transform them into index values in such a way that the key values are distributed randomly across all the indices of a hash table.
- What are the techniques that you use to handle the collisions in hash tables
Answer: We can use two major techniques to handle the collisions. They are open addressing and separate chaining. In open addressing, data items that hash to a full array cell are placed in another cell in the array. In separate chaining, each array element consist of a linked list. All data items hashing to a given array index are inserted in that list.
- In Unix OS, what is the file server?
Answer: The file server is a machine that shares its disk storage and files with other machines on the network.
- What is CVS? List some useful CVS commands
Answer: CVS is Concurrent Version System. It is the front end to the RCS revision control system which extends the notion of revision control from a collection of files in a single directory to a hierarchical collection of directories consisting of revision controlled files. These directories and files can be combined together to form a software release.
There are some useful commands that are being used very often. They are
There are some useful commands that are being used very often. They are
cvs checkout
cvs update
cvs add
cvs remove
cvs commit
cvs update
cvs add
cvs remove
cvs commit
- How do you check for the httpd.conf consistency and any errors in it?
apachectl configtest
- Why do I get the message "… no listening sockets available, shutting down"?
In Apache 2 you need to have a listen directive. Just put Listen 80 in httpd.conf.
- How do you set up a virtual host in Apache?
<VirtualHost www.techinterviews.com>
ServerAdmin admin@techinterviews.com
DocumentRoot /home/apache/share/htdocs/hostedsites
ServerName www.techinterviews.com
ErrorLog /home/apache/logs/error/hostedsites/error_log
TransferLog /home/apache/logs/access/hostedsites/access_log
</VirtualHost>
- What is Server Type directive?
It defines whether Apache should spawn itself as a child process (standalone) or keep everything in a single process (inetd). Keeping it inetd conserves resources. This is deprecated, however.
- What is mod_vhost_alias?
It allows hosting multiple sites on the same server via simpler configurations.
- What does htpasswd do?
- It creates a new user in a specified group, and asks to specify a password for that user.
- If you specify both deny from all and allow from all, what will be the default action of Apache?
In case of ambiguity deny always takes precedence over allow.
- What is Semaphore? What is deadlock?
Semaphore is a synchronization tool to solve critical-section problem, can be used to control access to the critical section for a process or thread. The main disadvantage (same of mutual-exclusion) is require busy waiting. It will create problems in a multiprogramming system, where a single CPU is shared among many processes.
Busy waiting wastes CPU cycles.
Deadlock is a situation when two or more processes are waiting indefinitely for an event that can be caused by only one of the waiting processes. The implementation of a semaphore with a waiting queue may result in this situation.
- What is the main advantage of creating links to a file instead of copies of the file?
The main advantage is not really that it saves disk space (though it does that too) but, rather, that a change of permissions on the file is applied to all the link access points. The link will show permissions of lrwxrwxrwx but that is for the link itself and not the access to the file to which the link points. Thus if you want to change the permissions for a command, such as su, you only have to do it on the original. With copies you have to find all of the copies and change permission on each of the copies.
- Write a command to find all of the files which have been accessed within the last 30 days
find / -type f -atime -30 > December.files
This command will find all the files under root, which is ‘/’, with file type is file. ‘-atime -30′ will give all the files accessed less than 30 days ago. And the output will put into a file call December.files.
- What is the most graceful way to get to run level single user mode?
A: The most graceful way is to use the command init s.
If you want to shut everything down before going to single user mode then do init 0 first and from the ok prompt do a boot -s.
If you want to shut everything down before going to single user mode then do init 0 first and from the ok prompt do a boot -s.
29. How do you log in to a remote Unix box?
Using telnet server_name or ssh -l ( ssh - OpenSSH SSH client (remote login program))
30. What is the difference between an argument and an option (or switch)?
An argument is what the command should act on: it could be a filename, directory or name. An option is specified when you want to request additional information over and above the basic information each command supplies.
- Explain the difference between a static library and a dynamic library?
Static library is linked into the executable, while a dynamic library (or shared object) is loaded while the executable has started.
- How do you create a static library?
If you have a collection of object (.o) files, you can do it by running ar command. Generally a static library has a .a extension, and you can link it into an executable by providing -l libraryname to gcc.
- Where should the developed libraries be installed on the system?
GNU recommends /usr/local/bin for binaries and /usr/local/lib for libraries.
- What’s LD_LIBRARY_PATH?
It’s an environment variable that lists all the directories which should be searches for libraries before the standard directories are searched.
- How do you create a shared library?
Create the object file with -fPIC for position-independent code, then run gcc with -shared option.
- How do you install a shared library?
Run ldconfig in the standard directory that it’s installed in.
- What does ldd do?
It shows a list of installed shared libraries.
- How do you dynamically load a library in your app?
Use dlopen()
39. What does nm command do?
It reports the list of symbols in a given library.
wc
kill 0
- What’s the conditional statement in shell scripting?
if {condition} then … fi
- How do you do number comparison in shell scripts?
ps-eq, -ne, -lt, -le, -gt, -ge
- How do you test for file properties in shell scripts?
-s filename tells you if the file is not empty, -f filename tells you whether the argument is a file, and not a directory, -d filename tests if the argument is a directory, and not a file, -w filename tests for writeability, -r filename tests for readability, -x filename tests for executability
- How do you do Boolean logic operators in shell scripting?
tests for logical not, -a tests for logical and, and -o tests for logical or.
- How do you find out the number of arguments passed to the shell script?
$#
- What’s a way to do multilevel if-else’s in shell scripting?
if {condition} then {statement} elif {condition} {statement} fi
- How do you write a for loop in shell?
for {variable name} in {list} do {statement} done
- How do you write a while loop in shell?
while {condition} do {statement} done
- How does a case statement look in shell scripts?
case {variable} in {possible-value-1}) {statement};; {possible-value-2}) {statement};; esac
- How do you read keyboard input in shell scripts?
read {variable-name}
- How do you define a function in a shell script?
function-name() { #some code here return }
- How does getopts command work?
The parameters to your script can be passed as -n 15 -x 20. Inside the script, you can iterate through the getopts array as while getopts n:x option, and the variable $option contains the value of the entered option.
- When I do ps -aux, why do I have one copy of httpd running as root and the rest as nouser?
You need to be a root to attach yourself to any Unix port below 1024, and we need 80.
- Why do I get the message "… no listening sockets available, shutting down"?
In Apache 2 you need to have a listen directive. Just put Listen 80 in httpd.conf.
- What is ServerType directive?
It defines whether Apache should spawn itself as a child process (standalone) or keep everything in a single process (inetd). Keeping it inetd conserves resources. This is deprecated, however.
- What is mod_vhost_alias?
It allows hosting multiple sites on the same server via simpler configurations.
- What does htpasswd do?
It creates a new user in a specified group, and asks to specify a password for that user.
- If you specify both deny from all and allow from all, what will be the default action of Apache?
In case of ambiguity deny always takes precedence over allow.
58. What is the difference between binaries in /bin, and /usr/bin?
/bin - would contains the binaries frequently used by the normal user (as well as system administrator)
/usr/bin - would contains the binaries rarely used by the normal user (as wel as system administrator)
/usr/bin - would contains the binaries rarely used by the normal user (as wel as system administrator)
59. How are devices represented in UNIX?
All devices are represented by files called special files that are located in/dev directory.
60. Discuss the mount and unmount system calls
The privileged mount system call is used to attach a file system to a directory of another file system; the unmount system call detaches a file system.
61. How does the inode map to data block of a file?
Inode has 13 block addresses. The first 10 are direct block addresses of the first 10 data blocks in the file. The 11th address points to a one-level index block. The 12th address points to a two-level (double in-direction) index block.
62. Explain fork() system call
The `fork()' used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent.
63. List the system calls used for process management:
System calls Description
fork() - To create a new process
exec() - To execute a new program in a process
wait() - To wait until a created process completes its execution
exit() - To exit from a process execution
getpid() - To get a process identifier of the current process
getppid() - To get parent process identifier
nice() - To bias the existing priority of a process
brk() - To increase/decrease the data segment size of a process.
64. Explain Boot sequence summary
BIOS [When booting from a hard disk, the PC system BIOS loads and executes the boot loader code in the MBR]
Master Boot Record (MBR) (The very first sector of the hard disk is reserved for the same purpose and is called the master boot record (MBR).]
- How will you compile the Kernel ?
The Linux kernel is the heart of the operating system. This is the software that takes care of the programs that are currently running on your system as well as handling the interactions of those processes with your hardware. The kernel will decide how much CPU time and usage is allowed to the various programs.
Getting the source
The bz2 files are always significantly smaller than the .gz so you will always want to go in for these archives
Unpacking the source
Now to un-compress the kernel. You should be in /usr/src. You will have to be root to compile the new kernel.
If it's a tar.gz file
tar zxvf linux-2.2.16.tar.gz
or
gzip -dc linux-2.2.16.tar.gz | tar xvf -
For bzip'ed file
tar xIvf linux-2.2.16.tar.bz2
or
bzip2 -dc linux-2.2.16.tar.bz2 | tar xvf -
This should create a directory named 'linux' in here containing the new kernel. You might want to move this to a new directory the reflects the Linux kernel version and set up a symlink named 'linux' to point to this new directory.
mv linux linux-2.2.16
ln -s linux-2.2.16 linux
Compiling
create a configuration to use for the kernel compile. Run the following command
make menuconfig (menu based configuration interface)
make dep (
builds the tree of interdependencies in the kernel source)
make clean (
purges any now-unwanted files left from previous builds of the kernel.)
make bzImage
make modules
cp /usr/Linux/src/arch/i386/boot/zImage /boot/newkernel (
Installing a New Kernel)
make modules_install (
This will install the modules in /lib/modules)
Edit the /etc/grub.conf file
66. Explain the different RAID LEVELS?
There are number of different RAID levels:
Level 0 -- Striped Disk Array without Fault Tolerance: Provides data striping (spreading out blocks of each file across multiple disk drives) but no redundancy. This improves performance but does not deliver fault tolerance. If one drive fails then all data in the array is lost.
- Level 1 -- Mirroring and Duplexing: Provides disk mirroring. Level 1 provides twice the read transaction rate of single disks and the same write transaction rate as single disks.
- Level 2 -- Error-Correcting Coding: Not a typical implementation and rarely used, Level 2 stripes data at the bit level rather than the block level.
- Level 3 -- Bit-Interleaved Parity: Provides byte-level striping with a dedicated parity disk. Level 3, which cannot service simultaneous multiple requests, also is rarely used.
- Level 4 -- Dedicated Parity Drive: A commonly used implementation of RAID, Level 4 provides block-level striping (like Level 0) with a parity disk. If a data disk fails, the parity data is used to create a replacement disk. A disadvantage to Level 4 is that the parity disk can create write bottlenecks.
- Level 5 -- Block Interleaved Distributed Parity: Provides data striping at the byte level and also stripe error correction information. This results in excellent performance and good fault tolerance. Level 5 is one of the most popular implementations of RAID.
- Level 6 -- Independent Data Disks with Double Parity: Provides block-level striping with parity data distributed across all disks.
- Level 0+1 – A Mirror of Stripes: Not one of the original RAID levels, two RAID 0 stripes are created, and a RAID 1 mirror is created over them. Used for both replicating and sharing data among disks.
- Level 10 – A Stripe of Mirrors: Not one of the original RAID levels, multiple RAID 1 mirrors are created, and a RAID 0 stripe is created over these.
Level 7: A trademark of Storage Computer Corporation that adds caching to Levels 3 or 4.
67. How to disable the quotas at kernel level?
Goto etc/fstab, remove the quota tag, remount (mount /home -o remount) for /home
68. How to disable the ping?
echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
This disables ping responses.
To make this permanent set the following into /etc/sysctl.conf (if you have such a file)
net.ipv4.conf.icmp_echo_ignore_all = 1
69. How to enable IP-Forwarding ?
echo 1 > /proc/sys/net/ipv4/ip_forward
To enable permanently, edit /etc/sysconfig/network and change or add the following line:
FORWARD_IPV4 = YES or FORWARD_IPV4=true
70. How to find the block size?
Using dumpe2fs <device> or tune2fs –l <device>
71. How to convert ext3 to ext2?
tune2fs –j <device>
72. How you will see a port is opened or not?
netstat –an |grep LISTEN (or) nmap ipaddress
73. What is IP masquerading ?
A. In computer networking, network address translation (NAT, also known as network masquerading or IP-masquerading) is a technique in which the source and/or destination addresses of IP packets are rewritten as they pass through a router or firewall.
No comments:
Post a Comment