[Solved] How can I extract the output of a command line in JavaScript?


Don’t do in JavaScript what you can do from the command line.

In this case you could extract that number before passing it to your Node.js script

You must have awk available on your system so to extract that number you can simply do:

awk '/MemTotal/{print $2}' /proc/meminfo

1

solved How can I extract the output of a command line in JavaScript?