Unix Realtime Interview Questions (Shell Scripting)




Shell Scripting: Rare Skill

Its and interface between the hardware and user. it is the layer between the hardware and appplication programs.

Types of shells are korn, bourne, C-shell

All the unix flavours(like for eg:Sun Solaris, HP-UX, AIX, Linux) support these shells. One of the security feature of shell is that u can have multilple shells without effecting the work of other shells;

To check the available working shell use the following commands
basename $0
echo $$(check this pid with ps -e greppid)


You can find as much as u can using the man command man sh

AMAZON Hyderabad
_____________________________________________________

What is a i-node, what is the significance of inode in file structure?

Ans: The i-node is block that contains the information about
the file in the form of numbers which will uniquely identify the
file/dir location, can be said as the file registry, one of the
important and security feature of the linux/unix is the inode which
maintains the heirarchy of the files/dir.

How many inodes can be for a sub directory or file?

Each file/dir has 2 i-nodes which contains parent/child info

How to create a process??

Using system call "fork"


What is a process? what is a thread? dif between both

Process is a running command, thread is also similar to process, but
simultaneously running processes is called a thread(multiple processes
running simultaneously)

How u control the process( process handling)?

We can view the process info using top, ps commands and can control
those process using nice, renice, kill command

What is the scenario u handle , if there is a website problem?

Its a long concept if u have idea about DNS, apache, network
routes, configuration, system host configuration etc

1. Check the physical network
2. Check the system network statistics using the netstat or any tool
3. Check the system performance statistics
4. Check for the hardware failures in the system
5. Check the physical disk/problems
6. Check the system log or the application log
7. Check how many active users are accessing the system
8. Check the system configuration, how much it can take the load
9. Report the severity to the concerned person or if i am the person
to handle i shall start the following activity like(remember starting
a webserver is not so easy, requires the authority)

---check the webserver database
---stop the webserver
---restart the network services
---down and restart the database for consistency
---start the webserver

10. If I am not able to handle the task, definitely take the help of the
TEAM, because team work always gives us best result

IBM Interview
_________________________________________________________

1. How to find a current shell name/pid? ( use echo $$ and grep the pid from ps command or basename $0)

2. What is ORS in awk? ( output record separator)

3. What is environment variable for finding parent process id (PPID)

4. Creating one scenario, how to filter a passwd like file for filtering group id and corresponding
groupname should display (some lines code is there do practice it)

5. Which shell is better to use (its depend on the usage , but korn is better I think due to that
covers all the features of Borne, C shells)

Cognizant Interview
_____________________________________________________________


a. To find the login information, describe the script we do ( it needs the total 10 lines script, main logic is taken from the last command where we get the login information and use cut/grep/awk to achive that task)

b. Script for any disk status and mailing, describe what we do? (we can using
the df -h and filtering the 3rd column and comparing with certain %age
and mailing to the root about the critical issue)

c. What is egrep? What for it?

d. How to check your script is efficient? (little bit confusing, but
answer is I am confident about the script what we write with all kind of exceptional cases or we can say a script which is flexible without cause any harm)

e. How to execute the script? (First we must have execute permission
then, using the sh or ksh or bash or ./ filename from the script execute another script dot space script path)

f. Why we need scripts? (logical question but we can play with this question whoever asks)

LEHMAN BROTHERS (US)

________________________________________________________

1. Can u automate the ftp in scripts? how? (we should know the thorough
options of ftp first then we can take the variable in script and
reassign them in the script using some bind variable)
Here the basic steps required is composing the message that could do the sequence of commands required to perform ftp operations after the connection establishment.

EDS
_______________________________________________________


1. Suppose I want to monitor 10 systems with specified IP list, just
live/dead. How to do? (script is easily written from iplist from one file and
keeping loop to that and ping -c option and saving the output in one
file)
NFS

1.what is NFS?

2.what are the daemons in order?(nfsd,mountd,statd, lockd...)

3. What is the port number of NFS(111)

4. NFS runs on which protocol(RPC)

5. How to find the NFS version (nfsstat)

6. How to find the NFS server share (showmount -e IP)

7. How to see the active share in server machines( exportfs -v)

8. How many active nfs clients can share the server.

9. What is hard mount and soft mount, which one is better in live server env

10. How u permit user login mount (use automount with nis and nfs)

NIS

1. what is NIS

2. which port and protocol( same as NFS)

FTP

1. what is FTP?

2. how many ftp u used in Linux?

3.how many ports ftp uses(20 and 21 for data transfer)?

4.can u limit the ftp connections and bandwidth( we can do it in

configuration file with several options)?

DNS

1.what is DNS?

2.what all u do if a system is not in network

3.if a system goes fail what steps u do primarily

4.how u suspect the system has poor network status(

ifconfig,netstat,iptraf or netowrking monitoring tools)

5.if a system not pinging what could be the problem?
(check host file, nsswitch file , hosts.order file, resolv.conf)

6. How to find a system hostname from ip?
(use the dig, host command )

7. How to find a ethernet device?
(ethtool,dmesg, check in /dev)

SSH

1.what is SSH

2.what is the port

3.why u need the SSH(secure layer certificate exchange for the
messages , now the sites are using this SSL(secure socket layers))

4.hidden algorythem( hand shaking algorithm)

5.what is the advantage(has the different options which makes idle for
file transfer and secure connection)

6.what is port forwarding(check the man pages)

7.can be customized (can be customized for database operations and
record retrieval)

8.main configuration(sshd_config in etc

Optional Questions

a. How to exchange messages between two system securely eg chatting (maintain one script which reads the terminal output and redirecs that to remote terminal using the ssh)

b. How to run the script as a normal command( different approaches are there, but secure is set the path of the script , non-secure copy the script in /usr/local/bin or /usr/bin)

c. Difference between grep, fgrep, egrep (logic is latest grep has all the grep features)

1 Response to "Unix Realtime Interview Questions (Shell Scripting)"

  1. Unknown says:

    Greetings Mate,


    A really interesting, clear and easily readable Tutorials article of interesting and different perspectives' will clap. So much is so well covered here.

    Write a program to print Lowest Common Ancestor of given the values of two nodes in a binary search tree. You may assume that both values already exist in the tree.
    The program should take the inputs for the binary tree and construct the tree. Once the construction is over, the program takes 2 inputs to find out the LCA of those nodes.
    Eg: In the below given tree, the lowest common ancestor of 4 and 14 is 8.

    I read multiple articles and watched many videos about how to use this tool - and was still confused! Your instructions were easy to understand and made the process simple.


    Kind Regards,
    Bindu

Post a Comment

Powered by Blogger