# COMMAND

> Describe the commands the server has, for client libraries and cluster routing.

URL: https://docs.hotkv.com/commands/command/

```
COMMAND
COMMAND subcommand [argument ...]
```

- Group: Server
- Complexity: O(N) where N is the number of commands
- HotKV Cloud: all plans
- On-Premise: no license needed

`COMMAND` without arguments describes every command the server has, in the
same format as [COMMAND INFO](https://docs.hotkv.com/commands/command-info/index.md). Cluster-aware client
libraries read it at startup to learn where each command's keys are, so they
can send the command to the right node.

The subcommands below answer narrower questions. `COMMAND HELP` lists them.

## Subcommands

| Subcommand | What it does |
| --- | --- |
| [COMMAND COUNT](https://docs.hotkv.com/commands/command-count/index.md) | How many commands there are. |
| [COMMAND LIST](https://docs.hotkv.com/commands/command-list/index.md) | Every command and subcommand name, optionally filtered. |
| [COMMAND INFO](https://docs.hotkv.com/commands/command-info/index.md) | Arity, flags, key positions and ACL categories of commands. |
| [COMMAND DOCS](https://docs.hotkv.com/commands/command-docs/index.md) | A short documentation entry per command. |
| [COMMAND GETKEYS](https://docs.hotkv.com/commands/command-getkeys/index.md) | The keys a full command line would use. |
| [COMMAND GETKEYSANDFLAGS](https://docs.hotkv.com/commands/command-getkeysandflags/index.md) | The keys, and whether each is read or written. |

An unknown subcommand gets `ERR unknown subcommand '<name>'`.

## Return value

An array with one entry per command, as described on
[COMMAND INFO](https://docs.hotkv.com/commands/command-info/index.md).

## Examples

```
127.0.0.1:6379> COMMAND
  1) 1) "get"
     2) (integer) 2
     3) 1) "readonly"
        2) "fast"
     4) (integer) 1
     5) (integer) 1
     6) (integer) 1
     7) 1) "@read"
        2) "@string"
        3) "@fast"
  2) ...
```

## Compatibility

Redis 7 and Valkey 8 add three more elements to each entry (tips, key
specifications and subcommands). HotKV returns the first seven, which is
what client libraries use for routing. The commands HotKV adds (for example
`PCACHE.GET`) are included.

## See also

[COMMAND INFO](https://docs.hotkv.com/commands/command-info/index.md), [COMMAND GETKEYS](https://docs.hotkv.com/commands/command-getkeys/index.md),
[COMMAND LIST](https://docs.hotkv.com/commands/command-list/index.md), [ACL CAT](https://docs.hotkv.com/commands/acl-cat/index.md)