Command to get only the load average Linux [closed]
Asked Answered
T

1

10

I need a command to get a output of the load average of linux system to use on a script.

I know the command uptime, but using that command I get all that stuff i don't want, like: 12:09:31 up 20:57, 2 users, load average: 0.12, 0.10, 0.09.

How can I get only the load average on the output?

Like this: load average: 0.11 (for example)

Thank you for your help and sorry my poor english.

Tantrum answered 30/1, 2018 at 12:15 Comment(4)
Have you checked the /proc filesystem? Maybe you should?Entrails
ty @SomeprogrammerdudeTantrum
Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See What topics can I ask about here in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask.Spevek
uptime | awk '{print $8}'Inexorable
T
15

I just googled and found this.

Hope this helps :

http://www.brendangregg.com/blog/2017-08-08/linux-load-averages.html

I think this command will solves your question.

cat /proc/loadavg

Terchie answered 30/1, 2018 at 12:17 Comment(4)
Yeah, I know that command but it shows the load with other values, ty anyway.Tantrum
Have you seen the next command : cat /proc/loadavg. And btw it would be helpful if you express what type of result you expected.Terchie
I have edited my answer check it out!Terchie
If you are only interested in the load averages then you can do something like this as well: uptime | cut -d ',' -f 4-6 | sed -e 's/^[ \t]*//'Malonis

© 2022 - 2024 — McMap. All rights reserved.