2

I cant find way to monitor single linux terminal command.

I want to monitor this command:

php index.php parse

The problem is this process works too short to get pid so I hope there is something like this:

singlecommandmonitor php index.php parse

Where singlecommandmonitor is software witch monitors ram, cpu ect. usage and php index.php parse is command I want to monitor. It should work similar to sudo, but instead of giving root permissions it should monitor resources.

I hope someone will understand what I need :)

Thank you for answers.

  • You mean the process finishes too quickly for you to manually get the pid? So you'd like to run a process, but rather than seeing output from that process, you'd see top for that process? – Jo-Erlend Schinstad Jan 9 '14 at 8:26
  • Yes I need top of that process. The command runs for few seconds so it is difficult to get its pid and then run top -p – Lukas Ignatavičius Jan 9 '14 at 8:38
  • \time -v php index.php parse does something similar, but it would be better if it will be more like top -p – Lukas Ignatavičius Jan 9 '14 at 9:24
2

At least if you're launching the command in a bash shell, you might be able to use the internal variable $! which returns the PID of the last background job e.g.

php index.php parse & top -p $!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.