George Mason University 6 Programming Short Labs
Lab 1 – Installing Linux in a VM and Setting1. Download Virtual Box (2 points)
a. To download VirtualBox, go to https://www.virtualbox.org/
b. Click the download button to download VirtualBox so that you are redirected to the
webpage with different types of VirtualBox software supported by the operating system
of your computer
c. Download the VirtualBox supported by your operating system of your computer and
install it.
d. To install VirtualBox using the downloaded binary file, double click to install the file. An
installation dialogue will pop up. Click the Next Button to install using the Setup Wizard.
1
e. The next screen of the setup Wizard is for Custom Setup. Leave it at the default
selection and click Next
2
f.
Leave all default options checked and click Next
g. The next screen shows a warning. Proceed with the installation by clicking Yes
3
h. Click install to start the installation of VirtualBox. It should take several minutes.
i.
Before completing the installation, make sure that Start Oracle VM VirtualBox is
checked. Then click the Finish button to complete the installation. When your VirtualBox
virtualization environment launches on your desktop, take a screenshot. Paste the
screen shot in your lab report.
4
2. Downloading Fedora Linux (2 points)
a. Launch your browser and go to the fedora website (i.e. getfedora.org) and download a
fedora workstation Linux image
5
b. You will be redirected the download page and from there download the Linux ISO image
which is Fedora 35: x86_64 DVD ISO and save it on your computer. Dialog box will pop
up prompting you to save the Fedora-Workstation-Live-x86_64-35-1-2.iso file. Take
screenshot of this dialog box and paste it in your lab report. After that, save the live
ISO image on your computer. It should take a several minutes to download the image
and this will depend on the speed of your internet connection.
3. Creating a Fedora Workstation Linux VirtualBox VM (6 points)
a. To create your VirtualBox VM, go to VirtualBox and launch it, incase it is not running on
your computer and click Machine -> New to start the process of creating your VM. A
dialog box will pop up. In this dialog box, provide a Name, select a type and Version as
shown below
6
b. Set the memory size to 5000MB i.e 5GB
c. Select, Create a virtual disk now and click the Create button
d. Select the hard disk type, which is VDI (VirtualBox Disk Image) and click next
7
e. For storage on physical hard disk, select Dynamically allocated and click next
8
f.
For file location, leave the default location but change the size to 30GB and then click
Create. It should take several minutes to the create the VM
g. You will be able to see the Fedora VM on the right pane of the VirtualBox. However, it is
missing an operating system and it is powered off. Take a screenshot and save it in your
lab report
h. To install the operating system, which you downloaded, select the powered off Fedora
Linux VM in the right pane of VirtualBox. Click Settings in the right pane of VirtualBox
(you can also accomplish step by right clicking on the selected Fedora Linux VM).
9
i.
When the Settings dialog box pops up, Click Storage and in the Storage Devices pane,
select Empty under Controller: IDE and then click the CD icon on the right, click Choose a
Disk file to select the Fedora ISO Live image you downloaded from the Fedora website.
Observe that the Fedora ISO image file name will appear where the Controller IDE was
empty (see pics below). Click OK and this will close the dialog box.
10
j.
To start the installation, click the Start button to start the VM and installation
k. Use the up or down arrow keys on your keyboard to select Start Fedora-WorkstationLive 35
11
l.
In this next Window, click Install to Hard Drive to start the installation
m. To complete the installation, click Finish installation to get the Desktop and take a
screenshot. Save the screenshot in your lab report.
12
n. To navigate to the terminal, Click Activities on the Desktop, and the Show Activities Icon
in the Task bar below the desktop and select the terminal to launch it. Take a
screenshot of the terminal and paste it in your lab report.
o. Besides the GUI and the terminal in the GUI, Linux has several terminals (tty) which can
be launched by pressing CTRL+ALT+ Function Keys. For instance Terminal 4 (tt4) can be
launched by pressing CTRL+ALT+F4.
i. Can launch terminal 6 and take a screenshot of the login?
ii. Which terminal is the GUI?
iii. At the login type root and hit enter and take screenshot. The prompt changes
iv. Type shutdown and take a screenshot.
p. When the your Linux VM shuts down, remove the Linux image used in the installation.
Go the VM, Click Settings -> Select the Image in the Storage pane -> Click on the Disk
Icon -> Remove Disk From Virtual Drive
13
14
Lab 2 – Exploring Linux File Systems
For this lab we are going to explore the Linux Operating System and its file systems using a set of commands.
1. Start of your Virtual Linux Machine and login into the GUI to start your terminal. For those using Fedora, Click
Activities menu on the top left. This will reveal and menu bar at the bottom and then click the Show
Applications Icon
2. If your VM is installed on Windows, use the snipping tool to take your https://support.microsoft.com/enus/windows/use-snipping-tool-to-capture-screenshots-00246869-1843-655f-f220-97299b865f6b. When you
take the screen shots, paste them in our lab report. Otherwise if you VM is installed on a Mac, refer to this
link on how to take your screenshots https://support.apple.com/en-us/HT201361.
3. You are going to execute the following commands on the command prompt to explore the Linux OS and take
screenshots for questions which require you do so. Compile your lab report in a word document ( 10 points)
a. Type date;who and press Enter. Take a screenshot of the output. What is the purpose of the ;
metacharacter? (1 points)
b. Type echo This is OK and press Enter to display a message on the terminal screen. Take a screenshot
of the output (1 points)
c. Type echo This is not OK so don’t do it and press Enter to display a message on the terminal screen.
Press CRTL+C on your keyboard if you are using a Windows Keyboard or Command+C if you are using
a Mac Keyboard. Take a screenshot of the output (1 points)
d. Type echo This is not OK so don\’t do it and press Enter to display a message on the terminal screen.
Take a screenshot of the output (1 points)
e. Type echo $SHELL and press Enter to display the output on the screen and take a screenshot. What
does the output mean? (2 points)
f. Type man uname and press Enter to view the manual page for the uname command. Observe the
syntax of the uname command and answer the following questions and press q when finished to quit
the manual page and return to your command prompt.
• Which parameter displays the kernel version of the OS? (1 point)
• Which parameter displays network node name? (1 point)
• Which parameter displays Linux OS release date? (1 point)
4. You are going to execute the following commands on the command prompt to explore the Linux Filesystem
and take screenshots for questions which require you do so. (15 points)
a. Type pwd and press Enter to view the current working directory. What is your current working
directory? (1 points)
b. Type cd and press Enter and then type pwd and press Enter to view the current working directory.
Did your current working directory change? Why or why not? (1 points)
c. Type cd .. and press Enter and then type pwd and press Enter to view the current working directory.
Did your current working directory change? Why or why not? (1 points)
d. Type cd /etc and press Enter and then type ls and press Enter to view the current working directory.
Take a screenshot. (1 points)
e. Type whoami and press Enter to obtain the your username. Now type cd ~your_username where
your_username is the output you got from the executing the previous command and then press
Enter. Type pwd and press Enter to view the current working directory. Take a screenshot. Which
command performs the same function as the cd ~ command? (2 points)
f. Type ls /etc/skel and press Enter. Did you see a listing of any files? Now, type ls -a /etc/skel and
press Enter. What is special about these files? Take a screenshot (2 points)
g. Type cat /etc/hosts and press Enter to view the contents of the file hosts, which reside in the
directory /etc. Next, type cat –n /etc/hosts and press Enter. How many lines does the file have? Take
a screenshot. (2 points)
h. Type cat /etc/inittab and press Enter. Now type head -5 /etc/inittab and press Enter. How many
lines are displayed? Next, type head -3 /etc/inittab and press Enter. How many lines are displayed
and why? Take a screenshot (3 points)
i. Type tail /etc/inittab and press Enter. How many lines are displayed and why? Take a screenshot ( 2
points)
Lab 3 – Linux File System Management
For this lab we are going to explore the Linux Operating System and its file systems using a set of commands.
1. Start of your Virtual Linux Machine and login into the GUI to start your terminal. For those using Fedora, Click
Activities menu on the top left. This will reveal and menu bar at the bottom and then click the Show
Applications Icon
2. You are going to execute the following commands on the command prompt to explore the Linux OS and take
screenshots for questions which require you do so. Compile your lab report in a word document. At the
command prompt do the following (30 points)
a. Type mkdir mysamples and press Enter and then type ls -F at the command prompt, and press Enter
to verify the creation of the subdirectory. Take a screenshot (1 point)
b. Type cd mysamples and press Enter. Type ls -F at the command prompt and press Enter. What are
the contents of the subdirectory mysamples? What is your present working directory? (1 points)
c. Type mkdir undermysamples and press Enter. Next type mkdir todelete and press Enter. Lastly, type
ls -F at the command prompt and press Enter. Take a screenshot. (1 points)
d. Type touch sample1.txt at the command prompt and press Enter to create a text file in your home
folder. Type ls -F at the command prompt, and press Enter to verify the creation of the text file and
take a screenshot. (1 point)
e. Type cp sample1.txt mysamples/undermysamples and press Enter. Next, type ls -F at the command
prompt and press Enter. Was the file successfully copied? Take a screenshot. (2 points)
f.
Type cp mysamples mysamples2 and press Enter. What message do you get and why? (2 points)
g. Type cp -R mysamples mysamples2 and press Enter. Next type ls -F at the command prompt and
type Enter. Was the directory successfully copied? Take a screenshot (2 points)
h. Type mv sample1.txt mysamples2 and press Enter. Next, type ls -F at the command prompt and
press Enter. What happened to sample1.txt? (1 point)
i.
Type mv mysamples2 mysamples and press Enter. Next type ls -F at the command prompt and press
enter and take a screenshot. (1 point)
j.
Type cd mysamples and press Enter to change into the mysamples sub-directory. To create another
text file using an editor called gedit, type gedit sample2.txt and press Enter. When the editor
launches, type This is a test file. Click Save to save the contents of the text file and then click the X
button on the right hand side of the editor to close the editor. Next types ls on the command prompt
and take a screen shot. (1 point)
k.
To create a hardlink, type ln sample2.txt hardlinksample2. Next, type ls -F at the command prompt
and press Enter. Next, type ls -l at the command prompt and press Enter. Does the information in the
terminal output indicate that sample2.txt and hardlinksample2 are hard-linked? Next, type ls -li at
the command prompt and press Enter to view the inode numbers of each file. Do the two hard-linked
files have the same inode number? Take a screenshot (5 points)
l.
To check the contents of the hard linked file which you created, type cat hardlinksample2. Take a
screenshot. (1 point)
m. To create a symbolic link within mysamples directory, type ln –s /etc/sysconfig/network-scripts
netscripts and press Enter. Next, type ls -F at the command prompt and press Enter. What file type is
indicated for netscripts? Next, type cd netscripts at the command prompt and press Enter. Type pwd
at the command prompt and press Enter. What is your current directory? Next, type ls -F
/etc/sysconfig/network-scripts at the command prompt and press Enter. Note that your netscripts
directory is merely a pointer to the /etc/sysconfig/network-scripts directory. How can this type of
linking be useful? Take a screenshot (1 points)
n. In the next task we are going find the hosts file using two commands. Type locate hosts and press
Enter. Next type whereis hosts at the command prompt and press Enter. Since you now know where
to find the hosts file, type cat /etc/hosts and take a screenshot. (1 point)
o. Within the mysamples directory, there is a todelete directory which you are going to remove. Type
rmdir todelete and press Enter. Next, type ls –F at the command prompt and press Enter. Take a
screenshot. (1 point)
p. Type rmdir mysamples2 and press Enter. Take a screenshot. Was the sub-directory removed? Why?
(1 point)
q. Type rm -rf mysamples2 and press Enter. Take a screenshot. Was the sub-directory removed? Why?
(1 point)
r.
Within the mysamples directory type cd undersamples and press Enter to switch to the
undersamples sub-directory. Next type ls -l to view the mode/permissions as well as owner and
group for the sample1.txt file within that sub-directory. Take a screenshot. (1 point)
s. Type chmod 777 sample1.txt and press Enter to change the permissions on that file. Type ls -l and
press Enter to view the new permissions. Take a screenshot (1 point).
t.
Type ls -l /usr/bin/* |more and press Enter. Continue to press Enter to scroll through all the files
until you regain the command prompt. Who owns the files in the /usr/bin subdirectory and what is
the group of that user? (1 point)
u. Type sudo chown root sample1.txt and press Enter to change the ownership to that file. You will be
prompted to enter your password. Next type ls -l and press Enter. Has the ownership to the file
changed? Take a screenshot. (1 point)
v. Type ls -I /dev/sda1 and press Enter to display the mode on the sda1 storage device. Is this device a
block device or character device? Why? Take a screenshot. (1 point)
w. Type df -T and press Enter to display. What does the information generated by this command mean?
Take a screenshot. (1 point)
Lab 4 – Linux Server Deployment and the Bash Shell
For this lab we are going to explore the Linux Operating System and its file systems using a set of commands.
1. Start of your Virtual Linux Machine and login into the GUI to start your terminal. For those using Fedora, Click
Activities menu on the top left. This will reveal and menu bar at the bottom and then click the Show
Applications Icon
2. You are going to execute the following commands on the command prompt to explore the Linux OS and take
screenshots for questions which require you do so. Compile your lab report in a word document. At the
command prompt do the following (30 points)
a. Type su and press Enter to set the root user password. When prompted, enter your password to
launch the root terminal. Once at the root terminal, type whoami and press Enter. Take a screenshot
(1 point)
b. Type each of the following commands in turn and press Enter. Examine the output of each one. What
does the output of each command tell you? (6 points)
•
df -hT
•
cat /etc/ftab
•
lbslk
c. Type less /proc/cpuinfo and press Enter. Did the installation detect your CPU correctly? Type q and
press Enter to quit. Type exit and press Enter to exit (Hint: check your host machine and compare the
results). (6 points)
d. Type ls -l sample1 sample2 sample3 > file 2>file2 and press Enter. Is there any stdout displayed on
the terminal screen? Is there any stderr displayed on the terminal screen? Why? (2 points)
•
Type cat file and press Enter. What are the contents of the file and why? (2 points)
•
Type cat file2 and press Enter. What are the contents of the file2 and why? (2 points)
e. Type date >> file and press Enter. Take a screenshot (1 point)
f.
Type tr o O
Top-quality papers guaranteed
100% original papers
We sell only unique pieces of writing completed according to your demands.
Confidential service
We use security encryption to keep your personal data protected.
Money-back guarantee
We can give your money back if something goes wrong with your order.
Enjoy the free features we offer to everyone
-
Title page
Get a free title page formatted according to the specifics of your particular style.
-
Custom formatting
Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.
-
Bibliography page
Don’t pay extra for a list of references that perfectly fits your academic needs.
-
24/7 support assistance
Ask us a question anytime you need to—we don’t charge extra for supporting you!
Calculate how much your essay costs
What we are popular for
- English 101
- History
- Business Studies
- Management
- Literature
- Composition
- Psychology
- Philosophy
- Marketing
- Economics