Networking script I am working on. This prints some information about your machine.

Posted: September 23, 2012. At: 10:52 PM. This was 5 years ago. Post ID: 4613
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This Perl script will print some information about your networking set-up on your Linux machine.

#!/usr/bin/perl
 
use warnings;
 
$iface = "eth0";
 
@data = `ifconfig`;
 
$net = $data[1];
 
$kernel = `uname -r`;
 
printf("\n*-------------------------------------*\n");
 
printf("The IP of %s is:%s\n", $iface, $net);
printf("The kernel version is: %s\n", $kernel);
 
printf("\n*-------------------------------------*\n");

This is the output this script will give you.

jason@jason-desktop:~/Documents$ ./info.pl 
 
*-------------------------------------*
The IP of eth0 is:        inet 10.1.1.200  netmask 255.255.255.0  broadcast 10.1.1.255
 
The kernel version is: 4.10.0-32-generic
 
 
*-------------------------------------*

No comments have been made. Use this form to start the conversation :)

Leave a Reply