About w3reference
In w3reference you will find all LAMP tutorials you need, from Linux,perl,php,databases,linux,SQL,sed,awk and more... all the tutorials are free!. We are Constantly adding more stuff and making the site and tutorials more user friendly.Some interesting tips...
IP Multicast
Internet Protocol (IP) multicast is a technology that reduces traffic by simultaneously delivering a single stream of information to multiple recipients. Applications that take advantage of multicast include video conferencing, corporate communications, istance learning, and distribution of software, stock quotes (financial firms use multicast to get stock quotes from bloomberg,reuters..) and news.IP Multicast delivers source traffic to multiple receivers without adding any additional burden on the source or the receivers while using the least network bandwidth. High-bandwidth applications, such as MPEG video, may require a large portion of the available network bandwidth for a single stream. In these applications, the only way to send to more than one receiver simultaneously is by using IP Multicast.
PERL
perl subroutine to send email..$mailprogram should be your mailprogram, ie
$mailprogram = "/usr/sbin/sendmail";
&email($title,$message);
sub email {
my ($title, $message) = @_;
open (MAIL,"$mailprogram -t");
print MAIL "To: name@gnulamp.comn";
print MAIL "From: script@gnulamp.comn";
print MAIL "Subject: $titlenn";
print MAIL "$message n";
close(MAIL);
}
Wanna count the number of times ABC appears in text?
my $numtimes = 0; $numtimes++ while ($text =~ /b ABC b/gx));
#Change everything to upper case: $string =~ tr/[a-z]/[A-Z]/;PERL: How do I print out in color on Terminal?
If you know that user have an ANSI terminal that understands color, you can use the Term::ANSIColor is a module from CPAN:
use Term::ANSIColor;
print color("yellow"), "YELLOW!n", color("reset");
print color("green"), "GREEN!n", color("reset");
Or like this:
use Term::ANSIColor qw(:constants);
print RED, "red!n", RESET;
print GREEN, "green!n", RESET;
Linux Tips
VSIZE (Virtual memory SIZE) - The amount of memory the process is currently using. This includes the amount in RAM and the amount in swap.RSS (Resident Set Size) - The portion of a process that exists in physical memory (RAM). The rest of the program exists in swap. If the computer has not used swap, this number will be equal to VSIZE.
What Network Services are Running?
$ netstat -atup
$ netstat -ap|grep LISTEN|less
This can be helpful to determine the services running.
Need stats on dropped UDP packets?
$ netstat -s -u
TCP
$ netstat -s -t
summary of everything
$ netstat -s
looking for error rates on the interface?
$ netstat -i
Listening interfaces?
$ netstat -l
