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
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
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
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| 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 |
- Designing Electronics with Linux
- New Products
- Linux Systems Administrator
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Dynamic DNS—an Object Lesson in Problem Solving
- Web & UI Developer (JavaScript & j Query)
- Using Salt Stack and Vagrant for Drupal Development
Enter to Win an Adafruit Pi Cobbler Breakout 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 Pi Cobbler Breakout 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
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




5 hours 58 min ago
6 hours 32 min ago
7 hours 31 min ago
8 hours 21 min ago
12 hours 23 min ago
16 hours 10 min ago
16 hours 18 min ago
18 hours 33 min ago
21 hours 3 min ago
1 day 7 hours ago