Head and tail are as simple as its name, it is used to display the beginning or end of a certain number of text chunks, head to show the beginning of the file to the standard output, and tail take for granted is to see the end of the file.
1. Command format:
head [parameters] [file]
2. Command function:
The head is used to display the beginning of the file to the standard output, and the default head command prints the first 10 lines of its corresponding file.
3. Command parameters:
-Q Hide file names
-V Show file name
-C < bytes > Display bytes
-N < rows > rows displayed
4. Usage examples:
Example 1: Display the first n rows of a file
Command:
Head-n 5 Log.txt
Example 2: Displaying the first n bytes of a file
Command:
Head-c Log.txt
Example 3: The file's contents except the last N bytes
Command:
Head-c -32 Log.txt
Example 4: Output file except the last n rows of the entire content
Command:
Head-n-6 Log.txt
One Linux command per day (--head) command