Tag Info

New answers tagged

3

With minimally touching JavaScript (from my side), I'd suggest this: Run bash instead of ps - do all the searches and checks for bash and ps, and start the process for bash with arguments: -c, ps.path + ' aux > '+ filePathToOutputTo. The overall command here should look like: /bin/bash -c "/bin/ps aux > /path/to/output/file"


3

Looking through the list of command-line options accepted by ps in the ps manual page (accessible there and by running man ps) reveals it doesn't have an option for logging to a file. Many commands do not. But you can still make it do what you want. Redirecting with > or >>, as John1024 explains sends the standard output of your program to the file ...


2

Unix programs typically write their output to "standard out", also known as stdout. Using the shell feature of redirection, stdout can be sent to a file instead of the terminal. To send it to a file name file, use: ps aux >file The symbol > indicates redirection and should be followed by a file name. If the file already exists, it will be ...



Top 50 recent answers are included