npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

shell-history

1.1.0 • Public • Published

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

install

npm i shell-history

Downloadsweekly downloads

28

version

1.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability