Get the command history of the user's shell
npm install shell-history
import {shellHistory, shellHistoryPath} from 'shell-history';
console.log(shellHistory());
//=> ['ava', 'echo unicorn', 'node', 'npm test', …]
console.log(shellHistoryPath());
//=> '/Users/sindresorhus/.history'
Get an array of commands.
On Windows, unless the HISTFILE environment variable is set, this will only return commands from the current session.
Get the path of the file containing the shell history.
On Windows, this will return either the HISTFILE environment variable or undefined.
Parse a shell history string into an array of commands.