I want to display memory (RAM) of some commmand in Linux. For example, I write to command line this command - for run Python script:
python 'someScript.py'
I want to display how much memory this command (process) uses.
You can use 'time' command
/usr/bin/time -v python 'someScript.py'
note that this is not a built-in shell command
there are many commands that you can use:
proc/meminfo
top
htop
among this command I think top
is suitable for you, top clearly highlights which processes are consuming the most CPU cycles and memory
ps aux | grep "myscrip_name" | awk '{print $4}'
To display the % of memory being used by the running process myscript_name
. Obviously can get the memory used when you know the % used.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.