2016-06-13 22:57:19 -04:00
<!-- [metadata]>
+++
title = "node ls"
description = "The node ls command description and usage"
keywords = ["node, list"]
[menu.main]
parent = "smn_cli"
+++
<![end-metadata]-->
# node ls
2016-07-07 14:43:18 -04:00
```markdown
Usage: docker node ls [OPTIONS]
2016-06-13 22:57:19 -04:00
2016-07-07 14:43:18 -04:00
List nodes in the swarm
2016-06-13 22:57:19 -04:00
2016-07-07 14:43:18 -04:00
Aliases:
ls, list
2016-06-13 22:57:19 -04:00
2016-07-07 14:43:18 -04:00
Options:
-f, --filter value Filter output based on conditions provided
--help Print usage
-q, --quiet Only display IDs
```
2016-06-13 22:57:19 -04:00
Lists all the nodes that the Docker Swarm manager knows about. You can filter using the `-f` or `--filter` flag. Refer to the [filtering ](#filtering ) section for more information about available filter options.
Example output:
2016-07-22 07:13:30 -04:00
```bash
$ docker node ls
2016-06-13 22:57:19 -04:00
2016-07-22 07:13:30 -04:00
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active
38ciaotwjuritcdtn9npbnkuz swarm-worker1 Ready Active
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
```
2016-06-13 22:57:19 -04:00
## Filtering
The filtering flag (`-f` or `--filter` ) format is of "key=value". If there is more
than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"` )
The currently supported filters are:
* name
* id
* label
### name
2016-06-17 00:28:07 -04:00
The `name` filter matches on all or part of a node name.
2016-06-13 22:57:19 -04:00
The following filter matches the node with a name equal to `swarm-master` string.
2016-07-22 07:13:30 -04:00
```bash
$ docker node ls -f name=swarm-manager1
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e216jshn25ckzbvmwlnh5jr3g * swarm-manager1 Ready Active Leader
```
2016-06-13 22:57:19 -04:00
### id
The `id` filter matches all or part of a node's id.
2016-07-22 07:13:30 -04:00
```bash
$ docker node ls -f id=1
2016-06-13 22:57:19 -04:00
2016-07-22 07:13:30 -04:00
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active
```
2016-06-13 22:57:19 -04:00
#### label
The `label` filter matches tasks based on the presence of a `label` alone or a `label` and a
value.
The following filter matches nodes with the `usage` label regardless of its value.
```bash
$ docker node ls -f "label=foo"
2016-07-22 07:13:30 -04:00
2016-07-20 14:15:08 -04:00
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
1bcef6utixb0l0ca7gxuivsj0 swarm-worker2 Ready Active
2016-06-13 22:57:19 -04:00
```
## Related information
* [node inspect ](node_inspect.md )
* [node update ](node_update.md )
2016-07-19 17:01:31 -04:00
* [node ps ](node_ps.md )
2016-06-13 22:57:19 -04:00
* [node rm ](node_rm.md )