What are other head command options?

0121

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

  1. -n [number]: Specify the number of lines to display. For example, to show the first 5 lines:

    head -n 5 filename.txt
  2. -c [number]: Display the first specified number of bytes instead of lines. For example, to show the first 20 bytes:

    head -c 20 filename.txt
  3. -q: Suppress the output of the file headers when multiple files are specified. This means it won't print the file name before the output.

    head -q file1.txt file2.txt
  4. -v: Print the file name before the output, even when only one file is specified.

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

    head --help
  6. --version: Show the version information of the head command.

    head --version

These options can be combined as needed to tailor the output of the head command to your requirements.

0 Comments

no data
Be the first to share your comment!