linux - Redirect the output of watch command to a file with only one instance of the header printout -


i'trying measure memory usage of app smem reporting tool. want run memory measurement contimously every 5 seconds , output printout log file later investigation. want retain header in log file. far have concluded following command:

watch -n 5 "smem -t -k  | grep -e 'my_app | pid' | tee -a logfile.log" 

the printout succesfully redirected log file header line appears on every execution of watch command , looks :

pid user     command                         swap      uss      pss      rss    8505 jim      my_app                             0    14.8m    16.7m    22.9m    pid user     command                         swap      uss      pss      rss    8505 jim      my_app                              0    20.8m    23.7m    28.9m    

how can export 1 instance of header line in output file?


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -