Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone please point to some good sample files that helps to learn grep. This is for academic use. It should be a large one so that students could understand its importance

share|improve this question
Perhaps /usr/share/dict – Kevin Dec 7 '12 at 4:05
up vote 2 down vote accepted

The file /etc/services contains a list of known services. It is too long to read through, and it might be a good real world example of when to use grep.

linux@host$ cat /etc/services | grep 'http'

To demonstrate how to find out which port http uses, or

linux@host$ grep '80/tcp' /etc/services

To find out what service you can expect to find on port 80

share|improve this answer

You might want to use books from Project Gutenberg. They are in the public domain, are quite large (you can cat some books together if desired) and can be used to devise many real-world examples of grep.

Otherwise, Wikipedia gives a bunch of public domain resources which might be available in plain text format.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.