Linux
Finding the local IP address with ifconfig and sed
There are many ways to determine local IP addresses on Linux platforms. They almost always involve piping ifconfig into a number of grep, awk, cat, and/or tr commands.
Well, my new favorite approach is to pipe ifconfig into a single sed command :)
ifconfig | sed -n -e 's/:127\.0\.0\.1 //g' -e 's/ *inet addr:\([0-9.]\+\).*/\1/gp'
Neat, huh?! :)
Calculating CPU Usage from /proc/stat
I recently came across a number of forum topics asking how to calculate CPU usage from /proc/stat, which raised a very slight sense of challenge within me (was just in "the mood" to do some BASH scripting)... so, here's an example showing how to calculate CPU usage with a simple BASH script.
Recent comments
1 week 10 hours ago
2 weeks 3 days ago
2 weeks 3 days ago
2 weeks 3 days ago
2 weeks 3 days ago
2 weeks 3 days ago
2 weeks 3 days ago
5 weeks 3 days ago
5 weeks 3 days ago
6 weeks 4 days ago