Tech Tips
I use this simple script when troubleshooting network problems on machines when I can't see the screen—for example, when I'm under a desk, wiggling Ethernet cables to find a bad one. When I hear the pings, I know it's fixed. Or, you can use this to drive your coworkers nuts by running it on their machines and sending single pings at random times during the day (or perhaps substitute moo for ping).
I made this into a script because I can't remember that big long line, and I would hate to type it in a lot. Here's sonar.sh:
#!/bin/bash
#
# Written by Mike Studer a long time ago
# Make sure you obtain a nice submarine ping sound.
# ie., ping with an echo (sonar.au used here)
/usr/sbin/icmpinfo -vv | \
/usr/bin/nawk '$4 == "ICMP_Echo"
{print $0;
system("/usr/bin/aplay -q ~/sounds/sonar.au")}'
You need to install icmpinfo and aplay to use this.
Usage: Run this on the machine on which you want to make noise (test):
sudo sonar.sh
Run this on a machine that is trying to get to the test machine for a nonstop ping barrage:
ping {testmachine}
For a single ping, run this:
ping -c 1 {testmachine}
—Mike Studer
In addition to viewing text, the less command can be used for viewing nontext files. This is done by using less' ability to invoke a preprocessor for input files. These preprocessors then can change the way the file's contents are displayed. For example, suppose you had a script lesspipe.sh:
#! /bin/sh
case "$1" in
*.tar.gz) tar -tzvf $1 2>/dev/null
;;
esac
Make sure the script is executable, and set the LESSOPEN environment variable to:
LESSOPEN='|/path/to/lesspipe.sh %s'
Now you can use less to view the contents of .tar.gz files:
$ less autocorrect.tar.gz -rwxrwxrwx raogr/raogr 84149 2009-02-02 03:20 autocorrect.dat -rwxrwxrwx raogr/raogr 443 2009-02-02 03:21 generator.rb -rwxrwxrwx raogr/raogr 181712 2009-02-02 03:21 autocorrect.vim
More-sophisticated versions of lesspipe.sh are available. You already may have a version installed, or you may have the lessopen.sh script installed. If not, search the Internet for lesspipe.sh. With the more-sophisticated versions, you can do things like this:
$ less knoppix_5.1.1.iso CD-ROM is in ISO 9660 format System id: LINUX Volume id: KNOPPIX Volume set id: Publisher id: KNOPPER.NET ... /KNOPPIX /autorun.bat /autorun.inf /autorun.pif /boot /cdrom.ico /index.html /KNOPPIX/KNOPPIX /KNOPPIX/KNOPPIX-FAQ-EN.txt
—Gururaj Rao
I work all the time with a laptop, and as you all know, from time to time laptops can get hot. When you're actually using it as a “lap”-top, or when you're close enough to hear the fans, you know when it's heating up. But, when the conditions are such that you don't realize it's heating up, your laptop can get pretty hot. And, you've all heard the stories about laptops catching fire.
The following script monitors the temperature and slows down your system when it gets too hot. The script should be run as root from cron every minute or so. You need to install cpufrequtils to get it to work:
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:
# Get the temp of the core 0
core_O=`acpi -t | awk {'print $4'} | head -n 1`
# Get the temp of the core 1
core_1=`acpi -t | awk {'print $4'} | tail -n 1`
# Round the result of core_O
convert_O=$(echo "scale=0; $core_O/1.0" | bc)
# Round the result of core_1
convert_1=$(echo "scale=0; $core_1/1.0" | bc)
# Set maximum permissible temperature.
max=90
# Set temperature at which the CPU frequency can
# be increased again (if needed).
min=68
if (( $convert_O >= $max )) ; then
# Too hot, slow down to 800MHz.
cpufreq-set -f 800
echo "CPU temp higher than desired!!!" | \
mail -s "CPU temp too high, set frequency to half" root
elif (($convert_O <= $min)) ; then
# Cooled down, allow frequency to increase again if needed.
cpufreq-set -g ondemand
fi
As you can see, in the script, I actually use the temperature only of core 0, because I know that this core tends to overheat before core 1.
—Alberto
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- New Products
- RSS Feeds
- Tech Tip: Really Simple HTTP Server with Python
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




1 hour 22 min ago
2 hours 31 min ago
3 hours 17 min ago
3 hours 39 min ago
9 hours 53 min ago
15 hours 32 min ago
21 hours 31 min ago
21 hours 54 min ago
22 hours 4 min ago
22 hours 8 min ago