File Head in Shell

Level 117 keystrokes

head displays the first lines of a file.

Shell code

# Prints the first 5 lines of log.txt (-n sets the count)
# Without -n, head prints the first 10 lines
1head -n 5 log.txt

Output

2024-01-15 09:00:00 Server started
2024-01-15 09:00:01 Loading config
2024-01-15 09:00:02 Database connected
2024-01-15 09:00:03 Cache initialized
2024-01-15 09:00:04 Ready for requests
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Shell code and how often they appear.

  • -× 1
  • .× 1

More Shell examples at level 1

← Shell typing practice