Somar coluna em linux

Soma segundo campo da entrada padrão

echo -e "a 1\nb 2" | awk '{s+=$2} END {print s}'

Soma espaço em uso de todas patições locais (em MB)

df -m | awk '{n+=$3} END {print n}'

Soma uso de CPU de todos os processos em execucao

ps -A --sort -rss -o pid,comm,pmem,pcpu | awk '{n+=$4} END {print n}'

Soma uso de MEMORIA de todos os processos em execucao

ps -A --sort -rss -o pid,comm,pmem,pcpu | awk '{n+=$3} END {print n}'
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s