PURPOSE: The purpose of this lab is to interact with Unix by using a virtual machine and learn to create a script on Perl that reads through a file, counts the number of files, adds the size of each file, and gets the average file size.
a. What OS variant is the Unix Virtual Machine
There are around 18 variants of linux most of them are free. In the ALIAS Lab we have Ubuntu.
3. Berry Linux
4. Damn Small Linux
10. Mandrake Move
13. PCLinuxOS Preview
14. Sam (
16. Suse 9.1 and 9.2
17. Ubuntu Live (Debian)
Ubuntu: uses a Linux kernel, and its origin is based on Debian. Ubuntu is oriented to the user novel and average, with a strong focus on the easiness of use and to improve the user experience. It is composed of multiple software and normally distributed under a free license software or open source.
b. What is the basic IP configuration?
By typing the ifconfig command on Linux shows the actual configuration of our pc, also with this we are able to see or configure the parameters of the network interfaces such as the IP address (dynamic or static) and the netmask.
c. Can you access the internet? How?
It is possible to connect though eth0 which is the first Ethernet adapter or an Ethernet card, which is associated to an IP address, MAC address and other information about the networks. The network adapter interfaces a computer to a network
d. How does the OS compare to the OS you use on a daily basis
1. UBUNTU VS. WINDOWS 7
It is an free operating system that can be used by different types of users, a user with no prior experience in Windows or Ubuntu probably will find more friendly and easier to Ubuntu, because it is very easy to use and is also free. In other words, any person can go to the Ubuntu page, and download it to your computer easily, without any restriction, since it has no license. In addition to using it, you can study it, modify it, copy it to different external devices, and redistribute it freely. Not required it to do so, because even if it is free, it can be sold commercially.
We can assure that it is one of the operating systems that most leverages our computer, that with it we can run much faster than with other operating systems business tasks. This is due to that Ubuntu doesn't require great features to work.
ü It is a free (open Source) software
ü This system is based on the Debian distribution
ü Available in 3 architectures: Intel x 86, AMD64, Power PC and other distributions.
ü The Ubuntu developers are based in large measures of work in the communities of Debian and Gnome, both in the distributions of packages and in the graphic environment, and KDE environments.
ü The stable versions are released every 6 months and are kept up-to-date on security up to 18 months after its release.
ü The official desktop is Gnome and it is synchronized by their releases.
ü All releases of Ubuntu are provided free of charge. Distribution CDs are sent free of charge to anyone requesting it. You can also download from the Ubuntu page, ISO images of discs by direct transfer or under license from Bittorrent.
ü Language: Multilanguage.
1.2 WINDOWS 7
This version is designed for use on PCs, including desktops in homes and offices, laptops, tablet PCs, and media equipment center.
Unlike the great architectural leap and characteristics which suffered its predecessor Windows Vista to Windows XP, Windows 7 was conceived as an incremental and focused update of Vista and its NT 6.0 core, which allowed to maintain some degree of compatibility with applications and hardware that this was already supported. However, among the goals of development for Windows 7 importance was given to improve the graphical interface to make it more accessible to the user and include new features that would make tasks easier and faster, at the same time that efforts would be made to achieve a more lightweight, stable and fast system.
ü Proprietary operating system (Shared Source) is not open source.
ü The Windows 7 client versions were released in versions for Architecture 32-bit and 64-bit Home Basic, Home Premium, Professional and Ultimate editions. However, these product Server versions were released exclusively for 64-bit architecture.
ü It has 6 NT kernel
ü It is not free, since it has a Microsoft EULA license
ü Language: Multilanguage.
v PHASE 2:
Installation of Perl
1) Go to the following website: http://www.activestate.com/activeperl/downloads
2)Choose the appropriate version for your OS.
2) Once you have downloaded the program run it.
3) Click next to begin with the setup wizard.
4) Accept the license terms and click next
5) Select the features and click next
6) Choose the setup options and click next
7) Click Install
8) Click finish to finish installation
Screenshot for finishing the installation.
open(FILES, "files") or die "Can't open files\n"; #Open the file named files or show a message
my $numberFiles = 0; #Variable that will count the number of files
my $fileSizeTotal = 0; #variable that will store the size of each file
my $averageFileSize = 0; #variable that will hold the average
while(<FILES>) #reads the file record by record until no more records are found
chomp $_; #clear off the newlines from the end of each line
($date, $time, $ampm, $filesize, $filename) = split(" ", $_); #splits up a string and places it into an array
print "$filesize\t\t$filename\n"; #prints the value of $_ to show that it was read.
$numberFiles++; #the counter is incremented
$fileSizeTotal+=$filesize; #adds file sizes
$averageFileSize = $fileSizeTotal/$numberFiles; # calculates the average by dividing the total file size by the number of files
print("\nTotal Files: $numberFiles Average file size: $averageFileSize\n"); #prints the result
close(FILES); #closes the file