Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 am new to Linux and I am using command

watch "ps u -C appName >> logFile" 

to obtain the process info of appName and output into logFile.

However, it does not include the date time info.

I know that date command could return the date and time.

How could I insert the date command into the watch statement above so that the date would be included in the logFile for each watch command?


share|improve this question

migrated from Jun 1 '11 at 17:43

This question came from our site for professional and enthusiast programmers.

Since watch takes shell commands, give it a group command.

watch "{ date +'...' ; ps u -C appName ; } >> logFile" 
share|improve this answer

Something like watch "(date; ps u -C appName >> logFile)" should work

share|improve this answer

Your Answer


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