Posted by Derek@TheDailyLinux »
Add Comment »
When you’re working in an embedded Linux environment, liberal use of the sync command can be a headache saver. Here’s the thing: in most embedded systems, your OS will be running from something like an SD card or flash and you may be subject to unexpected power loss. When you’re editing files or making changes in the filesystem, some of these edits and/or changes are only written to buffer cache, not the flash disk (not yet anyways). sync will force the system to commit the buffer cache to the disk.
As always, be sure to check out the man page for more information.
Posted by Derek@TheDailyLinux »
Add Comment »
Simply put, perldoc is the man page of perl applications. Use it and use it often when dealing with perl utilities. For example:
perldoc open
Reveals…
System::Library::Perl:User.Contributed PeSystem::Library::Perl::5.8.8::open(3)
NAME
open − perl pragma to set default PerlIO layers for input and output
SYNOPSIS
use open IN => ":crlf", OUT => ":bytes";
use open OUT => ’:utf8’;
use open IO => ":encoding(iso−8859−7)";
use open IO => ’:locale’;
use open ’:utf8’;
use open ’:locale’;
use open ’:encoding(iso−8859−7)’;
use open ’:std’;
DESCRIPTION
Full‐fledged support for I/O layers is now implemented provided Perl is
configured to use PerlIO as its IO system (which is now the default).
...
...
Posted by Derek@TheDailyLinux »
Add Comment »
I’ve been on a kick recently about doing everything in the terminal and I became excited about the possibility of doing it through the terminal. I was excited until my little research on the subject revealed that this horse has been beaten left and right and up and down and diagonally. There were so many different ways of doing it, I sorta lost the urge to create a post about it. Well, here I am anyways listing the ones I found to be the most interesting. Check ‘em out if you’re interested…
http://fungi.yuggoth.org/weather/
http://linuxshellaccount.blogspot.com/2008/09/bash-script-to-get-weather-forecasts.html
telnet rainmaker.wunderground.com
curl http://weather.noaa.gov/pub/data/forecasts/city/state/city.txt
Posted by Derek@TheDailyLinux »
Add Comment »
A quick and easy way to troubleshoot network connections in an embedded Linux environment is to use the ping, tcpdump, and arp commands. This will allow you to see what might be happening with the traffic on your network at the packet level. Once scenario would be that you’re not getting a successful ping between two computers on the network. All reason tells you that it should be working, but maybe there’s something wrong at the driver level? To start troubleshooting, fire up tcpdump on the box being pinged (ip: 192.168.1.100) and specify the network interface and IP address of the machine doing the pinging (ip: 192.168.1.101):
tcpdump -i eth0 host 192.168.1.101
Now, run the ping test:
ping 192.168.1.100
At this point, if you get an output from tcpdump, you’ll know that the packet has made its way to the target machine (192.168.1.100). The next step would be to see if you ever received an acknowledgment from the target machine. Run arp on the machine doing the pinging (192.168.1.101):
arp -an
If you see something like ? (192.168.1.112) at (incomplete) on en1 [ethernet], that means you never got an acknowledgment back from the target machine (192.168.1.100).
At this point in this scenario, we would start to dive into what could be wrong. In this particular situation, it was a driver issue with assigning a MAC address to the interface.
This is just one scenario to get you familiar with how to use tcpdump and arp and gather information about the networking issue. Please refer to the utility man pages for more information.
Posted by Derek@TheDailyLinux »
Add Comment »
For those of you interested in programming a dialogue (simulating user actions) for an interactive program take a look at expect (pexpect if you’re into python). The tools are useful if you’re in an environment that needs a lot of test automation. Here’s an article that goes into a bit more detail:
http://www.noah.org/wiki/Pexpect#Description_of_Pexpect
Posted by Derek@TheDailyLinux »
Add Comment »
If enabled as an option in the pre-compiled kernel configuration, the file /proc/config.gz can inform you of what options your currently running kernel was compiled with. The writers over at Linux Insight have gone into a bit more detail about doing this. You can read up on it here:
http://www.linuxinsight.com/proc_config.gz.html