Certainly! Here are some examples of using the head command:
-
Display the first 5 lines of a file:
head -n 5 /path/to/your/file.txt -
Display the first 20 lines of a file:
head -n 20 /path/to/your/file.txt -
Display the first 10 lines of a file (default behavior):
head /path/to/your/file.txt -
Display the first 3 lines of multiple files:
head -n 3 /path/to/your/file1.txt /path/to/your/file2.txt -
Display the first 10 bytes of a file:
head -c 10 /path/to/your/file.txt -
Display the first line of a file:
head -n 1 /path/to/your/file.txt
These examples demonstrate how to use the head command to view specific lines or bytes from files. Adjust the file paths and line counts as needed for your use case.
