Memory usage by user

简介: A short little script I stumbled across when cleaning my $HOME.

A short little script I stumbled across when cleaning my $HOME. I do not think I wrote it myself - at least I can't recall that I did. Quite handy and it's small and compact using the commands ps, awk, sort and head:

 

ps aux --no-headers | awk '
{
name[$1] += $1;
pros[$1] += $4;
mem[$1] += $5
}
END {
for (var in name) {
print mem[var]" "var" "pros[var]
}
}' | sort -nr | head

 

The result is a top ten list of the users that consume the most memory:

 

741012 root 9.3
238152 bjorn 3.8
119380 thomasez 1.2
105332 krav 1.9
100804 lars 0.6
95916 ingvar 1.6
89720 kjetilho 1.5
78044 jo 1
74232 espen 0.8
73460 michael 0.4

 

There I am - at number five...

目录
相关文章
|
5月前
|
安全 数据处理 C#
深入理解C#中的Span<T>和Memory<T>
【1月更文挑战第8天】本文旨在探讨C#中引入的两个重要类型:Span<T>和Memory<T>。它们为开发者提供了一种高效且安全的方式来处理内存中的数据。文章首先介绍这两个类型的基本概念和用途,接着深入分析它们的工作原理和适用场景,并通过代码示例展示如何在实际应用中使用它们。
|
存储 缓存 大数据
Starrocks执行查询报错:Memory of process exceed limit. Used: XXX, Limit: XXX. Mem usage has exceed the limit of BE
Starrocks执行查询报错:Memory of process exceed limit. Used: XXX, Limit: XXX. Mem usage has exceed the limit of BE
|
数据库 缓存 Linux
pacman usage
pacman使用 安装了系统时候, 应该立马使用pacman-mirrors -c China更新源, 再使用pacman -Syyn更新系统 编辑/etc/pacman.conf添加 [archlinuxcn] SigLevel = Optional TrustedOnly Server = https://mirrors.
2183 0
|
Unix Shell Linux