Home Explore Blog CI



nushell

commands/docs/columns.md
09025c6726558b843950feb94edee8f5bb55aed0738006c300000003000005c4
---
title: columns
categories: |
  filters
version: 0.104.0
filters: |
  Given a record or table, produce a list of its columns' names.
usage: |
  Given a record or table, produce a list of its columns' names.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `columns` for [filters](/commands/categories/filters.md)

<div class='command-title'>Given a record or table, produce a list of its columns&amp;#x27; names.</div>

## Signature

```> columns {flags} ```


## Input/output types:

| input  | output       |
| ------ | ------------ |
| record | list\<string\> |
| table  | list\<string\> |
## Examples

Get the columns from the record
```nu
> { acronym:PWD, meaning:'Print Working Directory' } | columns
╭───┬─────────╮
│ 0 │ acronym │
│ 1 │ meaning │
╰───┴─────────╯

```

Get the columns from the table
```nu
> [[name,age,grade]; [bill,20,a]] | columns
╭───┬───────╮
│ 0 │ name  │
│ 1 │ age   │
│ 2 │ grade │
╰───┴───────╯

```

Get the first column from the table
```nu
> [[name,age,grade]; [bill,20,a]] | columns | first

```

Get the second column from the table
```nu
> [[name,age,grade]; [bill,20,a]] | columns | select 1

```

## Notes
This is a counterpart to `values`, which produces a list of columns' values.

Chunks
a7c3fba4 (1st chunk of `commands/docs/columns.md`)
Title: columns Command: Get Column Names from Records or Tables
Summary
The `columns` command extracts the names of columns from a record or a table and outputs them as a list of strings. It can be used to inspect the structure of data and is a counterpart to the `values` command.