What other head command options?

082

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  # Displays the first 5 lines
  2. -c: Specify the number of bytes to display.

    head -c 100 filename.txt  # Displays the first 100 bytes
  3. -q: Suppress the output of the file headers when multiple files are specified.

    head -q file1.txt file2.txt  # Displays the first lines of both files without headers
  4. -v: Always output headers giving file names, even when there is only one file.

    head -v filename.txt  # Displays the file name before the output

These options allow you to tailor the output of the head command to suit your needs.

0 Comments

no data
Be the first to share your comment!