# shell-history **Repository Path**: mirrors_sindresorhus/shell-history ## Basic Information - **Project Name**: shell-history - **Description**: Get the command history of the user's shell - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-19 - **Last Updated**: 2026-05-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # shell-history > Get the command history of the user's [shell](https://en.wikipedia.org/wiki/Shell_(computing)) ## Install ```sh npm install shell-history ``` ## Usage ```js import {shellHistory, shellHistoryPath} from 'shell-history'; console.log(shellHistory()); //=> ['ava', 'echo unicorn', 'node', 'npm test', …] console.log(shellHistoryPath()); //=> '/Users/sindresorhus/.history' ``` ## API ### shellHistory() Get an array of commands. On Windows, unless the `HISTFILE` environment variable is set, this will only return commands from the current session. ### shellHistoryPath() Get the path of the file containing the shell history. On Windows, this will return either the `HISTFILE` environment variable or `undefined`. ### parseShellHistory(string) Parse a shell history string into an array of commands. ## Related - [shell-path](https://github.com/sindresorhus/shell-path) - Get the $PATH from the shell - [shell-env](https://github.com/sindresorhus/shell-env) - Get environment variables from the shell