LINUX: get file size by user

(Reading time: 1 minute)

Sometimes it is necessary to list files size by users. For this you can use these basic Linux commands.

 

Formátovaný zápis:

find /path -type f -printf '%u %k\n' | awk '{ 
arr[$1] += $2
} END {
for ( i in arr ) {
print i": "arr[i]"K"
}
}';

 

Jednořádkový zápis:

find /path -type f -printf '%u %k\n' | awk '{ arr[$1] += $2 } END { for ( i in arr ) { print i": "arr[i]"K" } }';

Výpis:

vaclavd: 70892344K
root: 16K
Václav

Programátor... občas normální, častěji tak trochu blázen.

Website: www.valeas.cz
More in this category: My git log variant. »

 

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.