W3cubDocs

/Nushell

first for filters

Return only the first several rows of the input. Counterpart of `last`. Opposite of `skip`.

Signature

> first {flags} (rows)

Parameters

  • rows: starting from the front, the number of rows to return

Input/output types:

input output
binary binary
list<any> list<any>
range any

Examples

Return the first item of a list/table

> [123] |first
1

Return the first 2 items of a list/table

> [123] |first2
╭───┬───╮
01
12
╰───┴───╯

Return the first 2 bytes of a binary value

>0x[012345] |first2
Length:2 (0x2) bytes|printablewhitespaceascii_othernon_ascii
00000000:0123#

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/first.html