05.08.2013 Views

Module 11: Search and Sort Tools - E-Courses

Module 11: Search and Sort Tools - E-Courses

Module 11: Search and Sort Tools - E-Courses

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Operating Systems Prof. P. C. P. Bhat<br />

Indian Institute of Science Bangalore<br />

Operating Systems/<strong>Search</strong> <strong>and</strong> <strong>Sort</strong> <strong>Tools</strong> Question Bank<br />

Question Bank<br />

<strong>11</strong>.1 Which of the following comm<strong>and</strong>s are filters:<br />

a. ls<br />

b. ps<br />

c. egrep<br />

d. who<br />

e. find<br />

<strong>11</strong>.2 Suppose you have a phone file with names <strong>and</strong> associated phone number in each<br />

line. Can you use grep comm<strong>and</strong> to locate a friend’s phone number? How?<br />

<strong>11</strong>.3 List all the files in the current directory with names not exceeding two<br />

characters.<br />

<strong>11</strong>.4 How can we enforce restricting the search to the last 10 lines of the file in the<br />

phone file described in 1 above.<br />

<strong>11</strong>.5 Suppose a system has several user logged on – how will you find if your friend<br />

is logged on to the system?<br />

<strong>11</strong>.6 Suppose there are a large number of users who are logged on to the system. We<br />

need to sort the users in the order of their login time. How should we proceed if<br />

we only need to know the user who logged on earliest amongst them?<br />

<strong>11</strong>.7 What is the use of "find" comm<strong>and</strong> in UNIX environment? What are the options<br />

available with find comm<strong>and</strong> <strong>and</strong> how are the options utilized?<br />

<strong>11</strong>.8 What is the difference between the find <strong>and</strong> locate comm<strong>and</strong>?<br />

<strong>11</strong>.9 Write a program to print all the words in a file that occur twice consecutively in<br />

the file.<br />

Ex. The world world is not not enough<br />

Output :<br />

--------world<br />

not<br />

<strong>11</strong>.10 Assume the last file you created yesterday was called last20.<br />

How would you use find comm<strong>and</strong> to determine which files you<br />

have created today?<br />

P.C.P.Bhat/IISc Bangalore M<strong>11</strong>/V1/June 04/1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!