Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 2 down vote accepted

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 $!
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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