Skip to content

Get the command history of the user's shell

License

Notifications You must be signed in to change notification settings

toniov/shell-history

 
 

Repository files navigation

shell-history Build Status

Get the command history of the user's shell

Install

$ npm install --save shell-history

Usage

const shellHistory = require('shell-history');

console.log(shellHistory());
//=> ['ava', 'echo unicorn', 'node', 'npm test', ...]

console.log(shellHistory.path());
//=> '/Users/sindresorhus/.history'

API

shellHistory()

Get an array of commands.

On Windows it will always be an empty array as command history is not persisted there.

shellHistory.path()

Get the path of the file containing the shell history.

shellHistory.parse(string)

Parse a shell history string into an array of commands.

Related

  • shell-path - Get the $PATH from the shell
  • shell-env - Get environment variables from the shell

License

MIT © Sindre Sorhus

About

Get the command history of the user's shell

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%