FreeJobAlert.Com

Government Jobs | Results | Admit Cards

unix interview questions | Part8

If you would like to view All operating system interview questions only at one place visit below link

All UNIX Interview Questions

76. What is ex and vi ?
Ans: ex is Unix line editor and vi is the standard Unix screen editor.

77. Which are typical system directories below the root directory?
Ans: (1)/bin: contains many programs which will be executed by users (2)/etc : files used by administrator (3)/dev: hardware devices (4)/lib: system libraries (5)/usr: application software (6)/home: home directories for different systems.

78. Construct pipes to execute the following jobs?
Ans:
1. Output of who should be displayed on the screen with value of total number of users who have logged in displayed at the bottom of the list.
2. Output of ls should be displayed on the screen and from this output the lines containing the word ‘poem’ should be counted and the count should be stored in a file.
3. Contents of file1 and file2 should be displayed on the screen and this output should be appended in a file.
From output of ls the lines containing ‘poem’ should be displayed on the screen along with the count.
4. Name of cities should be accepted from the keyboard . This list should be combined with the list present in a file. This combined list should be sorted and the sorted list should be stored in a file ‘newcity’.
5. All files present in a directory dir1 should be deleted any error while deleting should be stored in a file ‘errorlog’.

79.Explain the following commands?
$ ls > file1
$ banner hi-fi > message
$ cat par.3 par.4 par.5 >> report
$ cat file1>file1
$ date ; who
$ date ; who > logfile
$ (date ; who) > logfile

80. What is the significance of the “tee” command?
Ans: It reads the standard input and sends it to the standard output while redirecting a copy of what it has read to the file specified by the user.

81. What does the command “ $who | sort –logfile > newfile” do?
Ans: The input from a pipe can be combined with the input from a file . The trick is to use the special symbol “-“ (a hyphen) for those commands that recognize the hyphen as std input.
In the above command the output from who becomes the std input to sort , meanwhile sort opens the file logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted output is redirected to the file newfile.

82. What does the command “$ls | wc –l > file1” do?
Ans: ls becomes the input to wc which counts the number of lines it receives as input and instead of displaying this count , the value is stored in file1.

83.Which of the following commands is not a filter man , (b) cat , (c) pg , (d) head
man A filter is a program which can receive a flow of data from std input, process (or filter) it and send the result to the std output.

84. How is the command “$cat file2 “ different from “$cat >file2 and >> redirection operators ?
Ans: is the output redirection operator when used it overwrites while >> operator appends into the file.

85. Explain the steps that a shell follows while processing a command.
Ans: After the command line is terminated by the key, the shell goes ahead with processing the command line in one or more passes. The sequence is well defined and assumes the following order.
Parsing: The shell first breaks up the command line into words, using spaces and the delimiters, unless quoted. All consecutive occurrences of a space or tab are replaced here with a single space.
Variable evaluation: All words preceded by a $ are valuated as variables, unless quoted or escaped.
Command substitution: Any command surrounded by back quotes is executed by the shell which then replaces the standard output of the command into the command line.
Wild-card interpretation: The shell finally scans the command line for wild-cards (the characters *, ?, [, ]).
Any word containing a wild-card is replaced by a sorted list of
filenames that match the pattern. The list of these filenames then forms the arguments to the command.
PATH evaluation: It finally looks for the PATH variable to determine the sequence of directories it has to search in order to hunt for the command.

86. What difference between cmp and diff commands?
Ans: cmp – Compares two files byte by byte and displays the first mismatch diff – tells the changes to be made to make the files identical

87. What is the use of ‘grep’ command?
Ans: ‘grep’ is a pattern search command. It searches for the pattern, specified in the command line with appropriate option, in a file(s).
Syntax : grep
Example : grep 99mx mcafile

Related Fresher Interview Questions

1. C Language Interview Questions
2. C++ Language Interview Questions
3. Data Structures Interview Questions
4. DBMS Interview Questions
5. Operating System Interview Questions
6. UNIX Interview Questions

Tags: basic unix interview questions, General UNIX interview questions, Some UNIX Interview Questions, unix commands, unix interview, unix interview faq, unix interview questions, Unix Interview Questions And Answers, unix interview questions and answers for freshers, unix interview questions and answers pdf, unix interview questions for freshers, unix interview questions with answers, unix shell scripting interview questions

Leave a Comment