logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

head.1 (1725B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd 2024-05-27
  5. .Dt HEAD 1
  6. .Os
  7. .Sh NAME
  8. .Nm head
  9. .Nd print first part of files
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl qvz
  13. .Op Fl c Ar size | Fl n Ar num | Fl Ar num
  14. .Op Ar file...
  15. .Sh DESCRIPTION
  16. .Nm
  17. reads each
  18. .Ar file
  19. in sequence and writes it's first part on standard output.
  20. If no
  21. .Ar file
  22. is given,
  23. .Nm
  24. reads from the standard input.
  25. .Sh OPTIONS
  26. .Bl -tag -width _c_size
  27. .It Fl c Ar size
  28. Read the first
  29. .Ar size
  30. bytes
  31. in each
  32. .Ar file .
  33. .Pp
  34. .Ar size
  35. can be multiplied by one of KMGTP (Kilo, Mega, Giga, Tera, ...)
  36. using power of 1024 by default, which can be either explicit via adding iB
  37. (like MiB), or turned into powers of 1000 by adding B (like MB).
  38. .It Fl n Ar num , Fl Ar num
  39. Read the first
  40. .Ar num
  41. lines in each
  42. .Ar file .
  43. .Pp
  44. The
  45. .Fl Ar num
  46. form is historical, new scripts should use the standard
  47. .Fl n Ar num
  48. form.
  49. .It Fl q
  50. Don't print header when multiple
  51. .Ar file
  52. are given.
  53. .It Fl v
  54. Always print header, regardless of the number of given
  55. .Ar file .
  56. .It Fl z
  57. Use NULL as line delimiter, not newline.
  58. .El
  59. .Pp
  60. If no option is specified,
  61. .Nm
  62. defaults to reading the first 10 lines.
  63. .Sh EXIT STATUS
  64. .Ex -std
  65. .Sh STDOUT
  66. Contains the specified part of each
  67. .Ar file ,
  68. with the following header when multiple
  69. .Ar file
  70. are given, or when
  71. .Fl v
  72. is set:
  73. .Bd -literal
  74. "==> %s <==\\n", <file>
  75. .Ed
  76. .Sh STANDARDS
  77. .Nm
  78. should be compliant with the
  79. IEEE Std 1003.1-2024 (“POSIX.1”)
  80. specification.
  81. .br
  82. The
  83. .Fl q ,
  84. .Fl v ,
  85. and
  86. .Fl z
  87. options are extensions.
  88. The
  89. .Fl Ar num
  90. option is historical.
  91. .Sh AUTHORS
  92. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me