Home Explore Blog CI



nushell

commands/docs/all.md
8bc6b8f7d81b7787a45fbc31708a6c10dd78f42033a7d5090000000300000549
---
title: all
categories: |
  filters
version: 0.104.0
filters: |
  Test if every element of the input fulfills a predicate expression.
usage: |
  Test if every element of the input fulfills a predicate expression.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

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

<div class='command-title'>Test if every element of the input fulfills a predicate expression.</div>

## Signature

```> all {flags} (predicate)```

## Parameters

 -  `predicate`: A closure that must evaluate to a boolean.


## Input/output types:

| input     | output |
| --------- | ------ |
| list\<any\> | bool   |
## Examples

Check if a list contains only true values
```nu
> [false true true false] | all {}
false
```

Check if each row's status is the string 'UP'
```nu
> [[status]; [UP] [UP]] | all {|el| $el.status == UP }
true
```

Check that each item is a string
```nu
> [foo bar 2 baz] | all {|| ($in | describe) == 'string' }
false
```

Check that all values are equal to twice their index
```nu
> [0 2 4 6] | enumerate | all {|i| $i.item == $i.index * 2 }
true
```

Check that all of the values are even, using a stored closure
```nu
> let cond = {|el| ($el mod 2) == 0 }; [2 4 6 8] | all $cond
true
```

Chunks
63ce2d98 (1st chunk of `commands/docs/all.md`)
Title: all command in Nushell
Summary
The `all` command in Nushell is a filter that checks if every element in a list fulfills a given predicate expression. It takes a closure as an argument that evaluates to a boolean for each element. The command returns `true` if all elements satisfy the predicate, and `false` otherwise. Several examples demonstrate its usage with lists, tables, and stored closures to test various conditions.