---
title: history
categories: |
history
version: 0.104.0
history: |
Get the command history.
usage: |
Get the command history.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->
# `history` for [history](/commands/categories/history.md)
<div class='command-title'>Get the command history.</div>
## Signature
```> history {flags} ```
## Flags
- `--clear, -c`: Clears out the history entries
- `--long, -l`: Show long listing of entries for sqlite history
## Input/output types:
| input | output |
| ------- | ------ |
| nothing | any |
## Examples
Get current history length
```nu
> history | length
```
Show last 5 commands you have ran
```nu
> history | last 5
```
Search all the commands from history that contains 'cargo'
```nu
> history | where command =~ cargo | get command
```
## Subcommands:
| name | description | type |
| ------------------------------------------------------ | -------------------------------- | -------- |
| [`history import`](/commands/docs/history_import.md) | Import command line history. | built-in |
| [`history session`](/commands/docs/history_session.md) | Get the command history session. | built-in |