Determining WHICH *nix distro is currently used…

Originally, I had run into the issue of trying to determine the *nix distribution – a command that would tell me the distribution and the build and everythign else I wanted to know. After reviewing some of the awesome comments left behind, here’s the updated perl script to determine the distribution (in Perl).

#!/usr/bin/env perl
use strict;
use warnings;

my ( $distro );
$distro = `lsb_release -i -s`;
chomp $distro;

my %installCmd = (
"Fedora" => \&fedora,
"Ubuntu" => \&ubuntu,


sub test {
if ( exists $installCmd{$distro} ) {
} else {
print "Supported Distributions are: ". join(', ' , keys %installCmd) . ".\n";

sub fedora { print "Hello from the Fedora Family!"; }
sub ubuntu { print "Hello from UBUNTU!!!"; }