Skip to main content
Version: 4.2.0

head Command

The head command returns the first n elements of the input stream and discards the remainder of the stream.

The command returns 100 elements by default if the number of elements is not specified.

Usage​

head <n>

Parameters​

ParameterDescriptionRequired?Default Value
nNumber of elements to return❌100

Examples​

Only take the first 2 elements of the JSON array
> json [1,2,3,4,5] | head -2
​1
​2
Only take the first 2 results of the search
> search is(volume) | head -2
​kind=gcp_disk, id=12, name=gke-1, age=5mo26d, cloud=gcp, account=eng, region=us-central1, zone=us-central1-c
​kind=gcp_disk, id=34, name=pvc-2, age=4mo16d, cloud=gcp, account=dev, region=us-west1, zone=us-west1-a