Job Interview




I. Interview Questions For Linux Admin



1. How do you list the files in directory while also showing hidden files?

 # ls -a

2. How do you execute a command in the background?

 &

3. What command will control the default file permissions when files are created?

 # umask

4. Explain the read, write, and execute permissions on a directory.

In linux the default permission on directory is 755 is the same as rwxr-xr-x.
where r-read(4),w-write(2),x-execute(1)
so rwx implies 4+2+1=7.

5. What is the difference between a soft link and a hard link?

(a link NEVER creates another copy of a file, only an inode pointer to a file or a file name)

Hard links create inode pointers to a files’ actual location and can only be created on the same filesystem

Soft links create an inode pointer to a file NAME and can be created to point to a file on ANOTHER filesystem.

6. Give the command to display space usage on the file system?

# df -h

7. Explain iostat, vmstat and netstat.

iostat returns disk and other data i/o statistics.
vmstat returns memory paging statistics, virtual and real.
netsta returns network statistics.
GENERALLY the first line or the command alone will return statistical averages since boottime; the commands can also be run with flags to report instantaneous snapshots every x seconds for y results (ie vmstat 5 5 gives a snapshot every 5 seconds 5 times in a row.

8. How would you change all occurrences of a value using VI?

%s/existing word/new word/g

9. Give two UNIX kernel parameters that effect an Oracle install.

shared memory and semaphores: shmmmax, shmmmin, etc and seminfo_semmsl (both affect the memory useage and sharing at the kernel level and usually a reboot is necessary for them to take affect safely (kernel parameters can be updated live on many Unix OS’s but is not recommended unless you are at the expert level and have performed the task before successfully on a sandbox)

10. Briefly, how do you install Oracle software on UNIX & LINUX.

Oracle can be installed from CD or better yet from CD’s copied in their entirety to a hard disk simply with the “runInstall” script.
a. make sure the filesystems you will be installing to have enough space AND no previous Oracle installation upon them.
b. MUST be run as the Oracle user NOT root. (ie: you need to have an oracle user account created with the proper rwx rights to the installation target filesystem)
c. several key variables such as hostname, some kernel parameters, and a few other pre-installation tasks need to be performed dependent upon the OS Oracle will be run upon.


II. Linux Administration Interview Questions

1. What is LILO?

LILO stands for Linux boot loader. It will load the MBR, master boot record, into the memory, and tell the system which partition and hard drive to boot from.

2. What is the main advantage of creating links to a file instead of copies of the file?

A: 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.

3. 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.

4. 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.

5. What does the following command line produce? Explain each aspect of this line.

    $ (date ; ps -ef | awk ‘{print $1}’ | sort | uniq | wc -l ) >> Activity.log

A: First let’s dissect the line: The date gives the date and time as the first command of the line, this is followed by the a list of all running processes in long form with UIDs listed first, this is the ps -ef. These are fed into the awk which filters out all but the UIDs; these UIDs are piped into sort for no discernible reason and then onto uniq (now we see the reason for the sort - uniq only works on sorted data - if the list is A, B, A, then A, B, A will be the output of uniq, but if it’s A, A, B then A, B is the output) which produces only one copy of each UID.

These UIDs are fed into wc -l which counts the lines - in this case the number of distinct UIDs running processes on the system. Finally the results of these two commands, the date and the wc -l, are appended to the file "Activity.log". Now to answer the question as to what this command line produces. This writes the date and time into the file Activity.log together with the number of distinct users who have processes running on the system at that time. If the file already exists, then these items are appended to the file, otherwise the file is created.


+Linux +Ubuntu +Fedora Jordan +Arch Linux +CentOS +Interview 

No comments:

Post a Comment