Commands tagged load average (6)

  • For each cpu set mask and then monitor your cpu infos. Temp,load avg. etc. For example for 2nd cpu or 2nd core taskset 0x00000002 yes > /dev/null & For example for 3rd cpu or 3rd core taskset 0x00000004 yes > /dev/null & For example for 4th cpu or 4th core taskset 0x00000008 yes > /dev/null & Monitor your cpu temp with this command if you want watch -n1 "acpi -t" Load avg. from top command top kerim@bayner.com http://www.bayner.com/


    8
    taskset 0x00000001 yes > /dev/null &
    kerim · 2011-04-03 07:23:53 15
  • Show the current load of the CPU as a percentage. Read the load from /proc/loadavg and convert it using sed: Strip everything after the first whitespace: sed -e 's/ .*//' Delete the decimal point: sed -e 's/\.//' Remove leading zeroes: sed -e 's/^0*//' Show Sample Output


    5
    sed -e 's/ .*//' -e 's/\.//' -e 's/^0*//' /proc/loadavg
    flatcap · 2014-04-18 19:12:05 10
  • This checks the system load every second and if it's over a certain threshold (.8 in this example), it spits out the date, system loads and top 4 processes sorted by CPU. Additionally, the \a in the first echo creates an audible bell.


    1
    while sleep 1; do if [ $(echo "$(cat /proc/loadavg | cut -d' ' -f1) > .8 " | bc) -gt 0 ]; then echo -e "\n\a"$(date)" \e[5m"$(cat /proc/loadavg)"\e[0m"; ps aux --sort=-%cpu|head -n 5; fi; done
    tyzbit · 2014-12-08 15:44:40 8
  • I run this via crontab every one minute on my machine occasionally to see if a process is eating up my system's resources.


    0
    load=`uptime|awk -F',' '{print $3}'|awk '{print $3}'`; if [[ $(echo "if ($load > 1.0) 1 else 0" | bc) -eq 1 ]]; then notify-send "Load $load";fi
    adimania · 2013-02-06 08:30:24 5
  • Monitoring system in one line : DISK : disk space MEM: memory ( mem , swap, Total) CPU : all information about cpu activity LOAD : load average Show Sample Output


    0
    echo "DISK:";df -Pl | grep -v "Filesystem" | awk '{print $5,$6}' ; echo "MEM:" ; free -mto | awk '{ print $1,$2,$3,$4 }'; echo "CPU:"; top -b -d1 -n1 | grep Cpu | awk '{print $2,$3,$4,$5,$6,$7,$8,$9}';echo "LOAD:"; cat /proc/loadavg
    injez · 2014-09-29 12:43:52 35
  • This “sysload” alias converts the load average to percentages and divides them by the number of CPUs/cores. It may provide a more intuitive guesstimate of how much work the server is doing. Show Sample Output


    0
    alias sysload='printf "System load (1m/5m/15m): "; for l in 1 2 3 ; do printf "%.1f%s" "$(( $(cat /proc/loadavg | cut -f $l -d " ") * 100 / $(nproc) ))" "% "; done; printf "\n"'
    lordtoran · 2021-03-27 17:10:53 141

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Remount root in read-write mode.
Saved my day, when my harddrive got stuck in read-only mode.

most used unix commands

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

how to export a table in .csv file
Exports the result of query in a csv file

List Threads by Pid along with Thread Start Time
This command will list all threads started by a particular pid along with the start time of each thread. This is very valuable when diagnosing thread leaks.

Create a tar archive using xz compression
Compress files or a directory to xz format. XZ has superior and faster compression than bzip2 in most cases. XZ is superior to 7zip format because it can save file permissions and other metadata data.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Create a QR code image in MECARD format
Add the QR code image on your webpage, business card ., etc, so people can scan it and quick add to their Contact Address Book. Tested on iPhone with QRreader.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: