Jul 1 2012
Limiting TOP command to a specific process name and keeping interactivity
Introduction
In this post we analyze the following command which allows you to run “top interactively without having to look up the pids” your interested in.
top -p `pgrep process-name | tr "\\n" "," | sed 's/,$//'`
 Analysis
The command is split into multiple sub commands.
- top: displays running processes. With -p option means monitor specific process IDs.
- pgrep: Looks through the currently running processes and lists the process IDs which matches the selection criteria (proccess-name).
- pipe (|): The pipe operator. It is used to direct the stdout of the first command to the stdin of the second command.
- tr (translate):Â Is used for replacing or removing specific characters in its input data set. Above: linefeed(\n) is replaced with comma(,) .
- sed:Â sed is used to remove the last comma(,) for the list. Sed is a stream editor which are used to perform basic text transformations on an input stream (a file or input from a pipeline). sed‘s ability to filter text in a pipeline particularly distinguishes it from other types of editors.

Aug 8 2012
Not bad for a setup on an old IBM thinkcenter A50
The server I describe in links 1) and 2) up for 52 days 🙂 . Not bad for a setup on an old IBM thinkcenter A50.
1)Â http://mbakopoulos.wordpress.com/2012/02/23/raid-6-backup-server-with-samba-windows-sharing-e-mail-monitoring-ubuntu-and-remote-desktop/
2)http://mbakopoulos.wordpress.com/2012/03/07/how-to-totally-disable-suspendhibernation-in-ubuntu-if-all-else-fails/
Now going on 83 days… call me a happy kid =)
By Menelaos Bakopoulos • Linux, Programming, Servers (*ix , scripting) 0