What are other head options?

The head command has several options that you can use to customize its behavior. Here are some commonly used options:

  1. -n: Specify the number of lines to display.

    head -n 5 filename.txt
  2. -c: Display the first specified number of bytes instead of lines.

    head -c 100 filename.txt
  3. -q: Suppress the output of the file headers when multiple files are being processed.

    head -q file1.txt file2.txt
  4. -v: Always output headers giving file names, even if there is only one file.

    head -v filename.txt
  5. --help: Display help information about the command and its options.

    head --help
  6. --version: Display version information about the head command.

    head --version

You can combine these options as needed. For example, to display the first 10 bytes of a file without headers, you could use:

head -c 10 -q filename.txt

0 Comments

no data
Be the first to share your comment!