We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

head and tail

Sometimes you don't want to print everything in a file. Files can be really big after all.

The head Command

The head command prints the first n lines of a file. The -n flag specifies n as shown:

head -n 10 file1.txt

If you don't specify a number using the -n flag, it will default to 10.

The tail Command

The tail command prints the last n lines of a file. The -n flag specifies n as shown:

tail -n 10 file1.txt

Assignment

Time to start investigating the bank's transactions.

  1. We print the first 6 lines because the first line in the file is the header, and we want to include that along with the first 5 transactions.

Submit the shell checks.