Posted: . At: 10:52 PM. This was 12 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.

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

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
 
 
*-------------------------------------*

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.