Back (Current repo: scraps)

random scraps and notes that are useful to me
To clone this repository:
git clone https://git.viktor1993.net/scraps.git
Log | Download | Files | Refs

commit 98b6a731ab6af6dfe759779c1fa95bff6d479202
parent 185a19eaa91f679683a4caaf454ef0149a7e9604
Author: root <root>
Date:   Fri, 25 Apr 2025 01:21:54 +0200

add new function

Diffstat:
Abash/funcs/get_memory_usage.sh | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/bash/funcs/get_memory_usage.sh b/bash/funcs/get_memory_usage.sh @@ -0,0 +1,13 @@ +#!/bin/bash +function get_memory_usage() { + ps -eo size,pid,user,command --sort -size | awk 'BEGIN{print "Memory (Mb) What"} + { + hr=$1/1024; + printf("%13.2f Mb ",hr); + } + { + for ( x=4 ; x<=NF ; x++ ) { + printf("%s \n",$x); + } + }' | awk '(NF==3){gsub(/^ +/, "", $0); print $0}' +}