Get the command history of the user's shell
$ npm install --save shell-history
const shellHistory = require('shell-history');
console.log(shellHistory());
//=> ['ava', 'echo unicorn', 'node', 'npm test', ...]
console.log(shellHistory.path());
//=> '/Users/sindresorhus/.history'
Get an array of commands.
On Windows it will always be an empty array as command history is not persisted there.
Get the path of the file containing the shell history.
Parse a shell history string into an array of commands.
- shell-path - Get the $PATH from the shell
- shell-env - Get environment variables from the shell
MIT © Sindre Sorhus