Home Explore Blog CI



nushell

1st chunk of `commands/docs/history.md`
3e3b6b6dcf6773bdd2483ca9bfe59891534f55ff5aaa9b080000000100000550
---
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 |

Title: history command documentation
Summary
This document describes the `history` command in Nushell, which retrieves and manages the command history. It includes usage instructions, flags for clearing history or displaying a long listing (for SQLite history), input/output types, examples of common uses, and links to subcommands for importing history and managing history sessions.