Unix - Filters and Commands


The main reasons for the success of pipes are

A. The availability of many filter programs
B. UNIX treats devices as files
C. It provides a 2-way communication channel
D. Both (a) and (b)

Option: D

Explanation :


Which of the following are not filter programs?

A. date
B. sort
C. cat
D. grep

Option: A

Explanation :


Redirection in pipes can be achieved by using

A. >
B. >>
C. tee
D. lpr

Option: C

Explanation :


Choose the correct statements.

A. The symbols > and | are both processed by shell
B. > can be used to direct output to a named file
C. | can be used to direct output to programs
D. All of above

Option: D

Explanation :


The command  who sort - file1 > file2

A. Results in an error
B. Sorts the contents of file1 and puts it in file2
C. Both (a) and (b)
D. None of the above

Option: D

Explanation :
the sort combines the output of who ('-' stands for the output of the previous command) and contents of file1 , and sorts the resultant. So, who | sort - file1 > file2 is equivalent to the sequence of commands who > x, cat x filel > y, sort > fi1e2. Hence the correct answer is (d).

Suggest an improvement