When I check list of processes and 'grep' out those that are interesting for me, the grep
itself is also included in the results. For example, to list terminals:
$ ps aux | grep terminal
user 2064 0.0 0.6 181452 26460 ? Sl Feb13 5:41 gnome-terminal --working-directory=..
user 2979 0.0 0.0 4192 796 pts/3 S+ 11:07 0:00 grep --color=auto terminal
Normally I use ps aux | grep something | grep -v grep
to get rid of the last entry... but it is not elegant :)
Do you have a more elegant hack to solve this issue (apart of wrapping all the command into a separate script, which is also not bad)
ps ux | awk '/name/ && !/awk/ {print $2}'
grep -v grep
part doing?grep -v grep
excludesgrep
from grep results. If grep is used in combination with ps, then grep process (with grep arguments) will be shown as well, cluttering your results. grep -v grep is a common way to avoid that