UNIX Interview Answers
- What is the major advantage of a hash table?
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?
We can use two major techniques to handle the collisions.
- Open addressing
In open addressing, data items that hash to a full array cell are placed in another cell in the array.
- Separate chaining.
In separate chaining, each array element consists 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?
The file server is a machine that shares its disk storage and files with other machines on the network.
- What is NFS? What is its job?
NFS stands for Network File System. NFS enables filesystems physically residing on one computer system to be used by other computers in the network, appearing to users on the remote host as just another local disk.
- What is CVS? List some useful CVS commands.
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 used quite often. They are:
cvs checkout
cvs update
cvs add
cvs remove
cvs commit
- 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 called December.files.
- How many prompts are available in a UNIX system?
Unix/ Linux four Prompts PS1, PS2, PS3, PS4
- Explain the UNIX Kernel.
Kernel is the core of UNIX. It manages and executing process. It the allocation and de-allocation of memory to processes. It enforces security measures and provides network services.
- How do you reverse a string in unix?
By using the [rev] command. For example:
$> echo "unix" | rev
xinu
- How do you remove the last line/ trailer from a file in UNIX script?
Always remember that [sed] switch '$' refers to the last line. So using this knowledge you can deduce the below command:
$> sed –i '$ d' file.txt
- How do you remove certain lines from a file in UNIX?
Here is an example of how to remove line
$> sed –i '5,7 d' file.txt
The above command will delete line 5 to line 7 from the file file.txt
Comment
Log in or create your account to react to the article.