List the first few lines of every file in a directory

bash, linux, shell

Solution

Use head command:

head -3 /path/to/dir/*

Problem

I'm trying to create a really simple bash script, which will list the first few lines of every file in a specific directory. The directory should be specified by the argument. I think that the Grep command should be used, but I have really no idea how. My existing script does not seem to work at all, so it's no use putting it in here.

Original source