You need to display or use just the beginning or end of a file.
Use the head or tail commands. By default, head will output the first 10 lines and tail will output the last 10 lines of the given file.
If more than one file is given, the appropriate lines from each of them are output. Use the -number switch (e.g., -5) to change the number of lines.
tail also has the -f and -F switches, which follow the end of the file as it is written to. “Skipping a Header in a File.”
head and tail, along with cat, grep, sort, cut, and uniq, are some of the most commonly used Unix text processing tools out there.
If you aren’t already familiar with them, you’ll soon wonder how you ever got along without them.