The head command has several options that you can use to customize its output. Here are some commonly used options:
-
-n: Specify the number of lines to display. For example,head -n 15 file.txtshows the first 15 lines. -
-c: Display a specific number of bytes instead of lines. For example,head -c 100 file.txtshows the first 100 bytes of the file. -
-q: Suppress the output of the file name when multiple files are specified. For example,head -q file1.txt file2.txtwill show the first lines of both files without repeating their names. -
-v: Always print the file name with the output, even if only one file is specified. -
--help: Display help information about the command and its options.
You can combine these options as needed. For example:
head -n 10 -c 50 file.txt
This command would show the first 10 lines or the first 50 bytes, depending on which comes first.
If you have more questions or need examples, feel free to ask!
