nushell/docs/commands/first.md
2019-10-02 15:49:44 -04:00

28 lines
1.7 KiB
Markdown

# first
Use `first` to retrieve the first "n" rows of a table. `first` has a required amount parameter that indicates how many rows you would like returned. If more than one row is returned, an index column will be included showing the row number.
## Examples
```shell
> ps | first 1
━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
pid │ name │ status │ cpu
───────┼──────────────┼─────────┼───────────────────
60358 │ nu_plugin_ps │ Running │ 5.399802999999999
━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
```
```shell
> ps | first 5
━━━┯━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━
# │ pid │ name │ status │ cpu
───┼───────┼──────────────┼─────────┼───────────────────
060754 │ nu_plugin_ps │ Running │ 4.024156000000000
160107 │ quicklookd │ Running │ 0.000000000000000
259356 │ nu │ Running │ 0.000000000000000
359216 │ zsh │ Running │ 0.000000000000000
459162 │ vim │ Running │ 0.000000000000000
━━━┷━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━
```