Computer System and Networks : Assignment
VerifiedAdded on 2020/04/15
|26
|2696
|46
AI Summary
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
COMPUTER SYSTEM
AND NETWORKS
AND NETWORKS
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Table of Contents
1. Introduction...................................................................................................................................1
2. Procedure for installing GNU/Linux............................................................................................1
3. Design Consideration.....................................................................................................................3
4. Results and Screenshots................................................................................................................5
5. Conclusion......................................................................................................................................5
References..............................................................................................................................................5
1
1. Introduction...................................................................................................................................1
2. Procedure for installing GNU/Linux............................................................................................1
3. Design Consideration.....................................................................................................................3
4. Results and Screenshots................................................................................................................5
5. Conclusion......................................................................................................................................5
References..............................................................................................................................................5
1
1. Introduction
The backbone of the Modern Information Systems is formed by the computer networks.
The computer network is a connection of computers connected together. The computers are
connected to exchange the resources. The GNU/Linux bash script will be created for monitoring
a computer system, user activity continuously and logs key information. The GNU/Linux bash
script will be created to automatically write the log file. The log file will be needed to provide
information of current processes of system, users currently logged in the system, Devices
plugged in the system that are USB, Disk usage of the system such as user’s home directory,
overall disk usage and other key directories, network interfaces and the states of network and
login time of the users, the applications installed in the system. The Ubuntu will be installed for
doing the assignment.
2. Procedure for installing GNU/Linux
The Linux is one kind of operating system. The Linux version Ubuntu 16.04 is installed.
Several features are there in the version (Raggi, 2011). The Graphical User Interface System is
developed in Ubuntu as a better way. It is very easy for installing in pc (Dalheimer and Welsh,
2009). The important advantage of a Linux is an open source technology, because it provides
many options to users. The security is increased in the Linux. Some of the problems are occurred
in the Ubuntu. The problems are Partitioning problems, Booting problems and problems
occurred for providing wireless connections. These problems are solved by some procedures
(Thomas, Thomas and Vugt, 2011).
Procedure
1. At windows Operating system open the START.
2. Create and format the hard disk partition.
3. Choose volume and shrink the volume value to 20000 in MB. This volume is
required for separate the unallocated area.
4. Restart the system and install Linux operating system.
5. Select the install Ubuntu option at the Ubuntu installation window(Lakshman,
2011)
2
The backbone of the Modern Information Systems is formed by the computer networks.
The computer network is a connection of computers connected together. The computers are
connected to exchange the resources. The GNU/Linux bash script will be created for monitoring
a computer system, user activity continuously and logs key information. The GNU/Linux bash
script will be created to automatically write the log file. The log file will be needed to provide
information of current processes of system, users currently logged in the system, Devices
plugged in the system that are USB, Disk usage of the system such as user’s home directory,
overall disk usage and other key directories, network interfaces and the states of network and
login time of the users, the applications installed in the system. The Ubuntu will be installed for
doing the assignment.
2. Procedure for installing GNU/Linux
The Linux is one kind of operating system. The Linux version Ubuntu 16.04 is installed.
Several features are there in the version (Raggi, 2011). The Graphical User Interface System is
developed in Ubuntu as a better way. It is very easy for installing in pc (Dalheimer and Welsh,
2009). The important advantage of a Linux is an open source technology, because it provides
many options to users. The security is increased in the Linux. Some of the problems are occurred
in the Ubuntu. The problems are Partitioning problems, Booting problems and problems
occurred for providing wireless connections. These problems are solved by some procedures
(Thomas, Thomas and Vugt, 2011).
Procedure
1. At windows Operating system open the START.
2. Create and format the hard disk partition.
3. Choose volume and shrink the volume value to 20000 in MB. This volume is
required for separate the unallocated area.
4. Restart the system and install Linux operating system.
5. Select the install Ubuntu option at the Ubuntu installation window(Lakshman,
2011)
2
6. Now choose the Check Boxes and click the continuous option.
7. Select install button.
8. Select an unallocated partition in the partition window.
9. Then enter the location to save.
10. And also select a keyboard format.
11. Provide the User Name and Password for the Operating System. And then
click continue option.
12. After completing the installation, Starts operation in Ubuntu
Bash SHELL
The Bourne again shell is a free version of a Bourne shell. It is distributed with operating
systems like GNU and Linux. The bash has the features like editing command line. The bash
includes the features from C shell and Korn shell (Smith, 2012). The command language script
runs in a bash shell. And it is written for a Sh shell. Bourne Again SHELL is the full form of
bash shell. Some of the people finds difficult with the bash shell. The bash scripting saves our
valuable time (Negus, 2013). It can automate the routine task. For a Linux power user, a
command line is the significant tools. On Linux, bash simplifies several tasks. Bash is needed for
the system administration and the remote access (Abbott, 2013).
Features
It becoming very popular. The command line editing modes have the features to attract
the people. When compared with C shell mechanism, it is very easy to go back as well as it fixes
its mistakes then modify the previous commands (Blum and LeBlanc, 2009). The advantages of
the bash is mainly for shell programmers and customizers. For the customization, the bash has
lot of variables and options. The bash's programming features involves advance input output
control, function definition, integer arithmetic, and more control structures (Makan, 2014)
Shell Scripting
The shell script is a computer program aimed to be run via the UNIX shell. The
numerous dialects of shell scripts are deliberated to be scripting languages (Chapelle, 2013). The
characteristic and typical processes is performed through shell script contains program execution,
file manipulation and printing text. The shell script is one kind of file. It has the ASCII text. The
3
7. Select install button.
8. Select an unallocated partition in the partition window.
9. Then enter the location to save.
10. And also select a keyboard format.
11. Provide the User Name and Password for the Operating System. And then
click continue option.
12. After completing the installation, Starts operation in Ubuntu
Bash SHELL
The Bourne again shell is a free version of a Bourne shell. It is distributed with operating
systems like GNU and Linux. The bash has the features like editing command line. The bash
includes the features from C shell and Korn shell (Smith, 2012). The command language script
runs in a bash shell. And it is written for a Sh shell. Bourne Again SHELL is the full form of
bash shell. Some of the people finds difficult with the bash shell. The bash scripting saves our
valuable time (Negus, 2013). It can automate the routine task. For a Linux power user, a
command line is the significant tools. On Linux, bash simplifies several tasks. Bash is needed for
the system administration and the remote access (Abbott, 2013).
Features
It becoming very popular. The command line editing modes have the features to attract
the people. When compared with C shell mechanism, it is very easy to go back as well as it fixes
its mistakes then modify the previous commands (Blum and LeBlanc, 2009). The advantages of
the bash is mainly for shell programmers and customizers. For the customization, the bash has
lot of variables and options. The bash's programming features involves advance input output
control, function definition, integer arithmetic, and more control structures (Makan, 2014)
Shell Scripting
The shell script is a computer program aimed to be run via the UNIX shell. The
numerous dialects of shell scripts are deliberated to be scripting languages (Chapelle, 2013). The
characteristic and typical processes is performed through shell script contains program execution,
file manipulation and printing text. The shell script is one kind of file. It has the ASCII text. The
3
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
text editor is used to create the shell script. The C shell and Bourne shell is most commonly used
in Linux as a shell (A Practical Guide to Ubuntu Linux?, 2011).
Shell scripting Advantages
1. It is used for automating the frequently used operations.
2. It is very simple to use.
3. The required commands are in single line.
4. It is portable one.
Disadvantages of shell scripting
a. The execution speed of script is very slow compared to other programming
languages (Deimeke et al., 2012).
b. One should launch the new process for the execution of each shell command.
Procedure to create the Shell Script in Linux
1. The Text editor, such as vi editor is used to create the shell script.
2. Type the script and save file.
3. Then close it.
4. Verify the script is executable.
5. Test the script and if one could satisfied with shown output and then move that to a
production environment.
3. Design Consideration
The running processes can be found out using the following commands
htop
pstree
atop
To obtain the information about users logged in the system, the below script command is used.
$ who
This command provide the information about the logged in users,
4
in Linux as a shell (A Practical Guide to Ubuntu Linux?, 2011).
Shell scripting Advantages
1. It is used for automating the frequently used operations.
2. It is very simple to use.
3. The required commands are in single line.
4. It is portable one.
Disadvantages of shell scripting
a. The execution speed of script is very slow compared to other programming
languages (Deimeke et al., 2012).
b. One should launch the new process for the execution of each shell command.
Procedure to create the Shell Script in Linux
1. The Text editor, such as vi editor is used to create the shell script.
2. Type the script and save file.
3. Then close it.
4. Verify the script is executable.
5. Test the script and if one could satisfied with shown output and then move that to a
production environment.
3. Design Consideration
The running processes can be found out using the following commands
htop
pstree
atop
To obtain the information about users logged in the system, the below script command is used.
$ who
This command provide the information about the logged in users,
4
To provide the users list currently logged in the machine.
$ users
Slynux slynux slynux hacker
To see every device plugged to the system and then to see the mount point the df command is
used.
$ df -h
The lsblk command is used to view the name of the USB devices.
To know the disk space available for usage, disk size and disk space used and the percentage of
disk usage, the below command is used.
$df -H
To execute the bash script as a different user, the below command is used.
su - $different _user
echo $HOME
To find out user's home directory the below command is used
$ cd
$ pwd
$ echo $HOME
$ grep username /etc/passwd
When one could need to create the output as a html file, the below command is used.
$ sudo lshw -html > lshw.html
To see the CPU information of Linux, use the below command
$ lscpu
To collect the block device data of a Linux, use this command
5
$ users
Slynux slynux slynux hacker
To see every device plugged to the system and then to see the mount point the df command is
used.
$ df -h
The lsblk command is used to view the name of the USB devices.
To know the disk space available for usage, disk size and disk space used and the percentage of
disk usage, the below command is used.
$df -H
To execute the bash script as a different user, the below command is used.
su - $different _user
echo $HOME
To find out user's home directory the below command is used
$ cd
$ pwd
$ echo $HOME
$ grep username /etc/passwd
When one could need to create the output as a html file, the below command is used.
$ sudo lshw -html > lshw.html
To see the CPU information of Linux, use the below command
$ lscpu
To collect the block device data of a Linux, use this command
5
$ lsblk
To view the information of USB ports, Graphic Cards, Network adapters, use the below
command.
$ lspci
To get information about the BIOS, use the below command
$ sudo dmi decode -t bios
Adding date and time
$ sudo date
To add the date and time in the log file, the above command is used.
4. Results and Screenshots
Script is created using the above commands and tested in Ubuntu 16.04 Desktop
htop gave the following results
6
To view the information of USB ports, Graphic Cards, Network adapters, use the below
command.
$ lspci
To get information about the BIOS, use the below command
$ sudo dmi decode -t bios
Adding date and time
$ sudo date
To add the date and time in the log file, the above command is used.
4. Results and Screenshots
Script is created using the above commands and tested in Ubuntu 16.04 Desktop
htop gave the following results
6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
pstree gave the following results
7
7
atop gave the following result
8
8
Wrote a simple menu driven script and tested the commands used in this work
9
9
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
#!/bin/bash
# grabsysinfo.sh - A simple menu driven shell script to to get information about a Linux server / desktop.
# Define variables
LSB=/usr/bin/lsb_release
# Purpose: Display pause prompt
# $1-> Message (optional)
function pause(){
local message="$@"
[ -z $message ] && message="Press [Enter] key to continue..."
read -p "$message" readEnterKey
10
# grabsysinfo.sh - A simple menu driven shell script to to get information about a Linux server / desktop.
# Define variables
LSB=/usr/bin/lsb_release
# Purpose: Display pause prompt
# $1-> Message (optional)
function pause(){
local message="$@"
[ -z $message ] && message="Press [Enter] key to continue..."
read -p "$message" readEnterKey
10
}
# Purpose - Display a menu on screen
function show_menu(){
date
echo "---------------------------"
echo " Main Menu"
echo "---------------------------"
echo "1. Uptime info"
echo "2. Utilisation info"
echo "3. Last logins info"
echo "4. Current connections info"
echo "5. CPU loads info"
echo "6. exit"
}
# Purpose - Display header message
# $1 - message
function write_header(){
local h="$@"
echo "---------------------------------------------------------------"
echo " ${h}"
echo "---------------------------------------------------------------"
}
# Purpose - Get info about Uptime of the system
function uptime_info(){
write_header " Uptime information "
echo "Uptime : $(uptime)"
[ -x $LSB ] && $LSB -a || echo "$LSB command is not insalled (set \$LSB variable)"
11
# Purpose - Display a menu on screen
function show_menu(){
date
echo "---------------------------"
echo " Main Menu"
echo "---------------------------"
echo "1. Uptime info"
echo "2. Utilisation info"
echo "3. Last logins info"
echo "4. Current connections info"
echo "5. CPU loads info"
echo "6. exit"
}
# Purpose - Display header message
# $1 - message
function write_header(){
local h="$@"
echo "---------------------------------------------------------------"
echo " ${h}"
echo "---------------------------------------------------------------"
}
# Purpose - Get info about Uptime of the system
function uptime_info(){
write_header " Uptime information "
echo "Uptime : $(uptime)"
[ -x $LSB ] && $LSB -a || echo "$LSB command is not insalled (set \$LSB variable)"
11
#pause "Press [Enter] key to continue..."
pause
}
# Purpose - Get info about Utilisation
function util_info(){
write_header " Utilisation "
echo "Utilisation : $(collectl)"
pause
}
# Purpose - Get info about Last loggins
function lastlog_info(){
local cmd="$1"
case "$cmd" in
last) write_header " List of last logged in users "; last ; pause ;;
esac
}
# Purpose - Display a list of Current connections
function user_info(){
local cmd="$1"
case "$cmd" in
who) write_header " Current Connections "; netstat -antp; pause ;;
esac
}
# Purpose - Display used and free memory info
12
pause
}
# Purpose - Get info about Utilisation
function util_info(){
write_header " Utilisation "
echo "Utilisation : $(collectl)"
pause
}
# Purpose - Get info about Last loggins
function lastlog_info(){
local cmd="$1"
case "$cmd" in
last) write_header " List of last logged in users "; last ; pause ;;
esac
}
# Purpose - Display a list of Current connections
function user_info(){
local cmd="$1"
case "$cmd" in
who) write_header " Current Connections "; netstat -antp; pause ;;
esac
}
# Purpose - Display used and free memory info
12
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
function cpul_info(){
write_header " CPU Loads "
echo "CPU Loads : $(top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}')"
pause
}
# Purpose - Get input via the keyboard and make a decision using case..esac
function read_input(){
local c
read -p "Enter your choice [ 1 - 6 ] " c
case $c in
1) uptime_info ;;
2) util_info ;;
3) lastlog_info "last";;
4) user_info "who";;
5) cpul_info ;;
6) echo "Bye!"; exit 0 ;;
*)
echo "Please select between 1 to 6 choice only."
pause
esac
}
# ignore CTRL+C, CTRL+Z and quit singles using the trap
trap '' SIGINT SIGQUIT SIGTSTP
# main logic
while true
do
clear
13
write_header " CPU Loads "
echo "CPU Loads : $(top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}')"
pause
}
# Purpose - Get input via the keyboard and make a decision using case..esac
function read_input(){
local c
read -p "Enter your choice [ 1 - 6 ] " c
case $c in
1) uptime_info ;;
2) util_info ;;
3) lastlog_info "last";;
4) user_info "who";;
5) cpul_info ;;
6) echo "Bye!"; exit 0 ;;
*)
echo "Please select between 1 to 6 choice only."
pause
esac
}
# ignore CTRL+C, CTRL+Z and quit singles using the trap
trap '' SIGINT SIGQUIT SIGTSTP
# main logic
while true
do
clear
13
show_menu # display memu
read_input # wait for user input
done
14
read_input # wait for user input
done
14
15
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
The script is attached below
16
16
Ran the script
17
17
18
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
mySysMonitor.sh creation
cd /home
19
cd /home
19
sudo touch mySysMonitor.sh
Giving permissions to mySysMonitor.sh
sudo chmod u+x mySysMonitor.sh
Editing the contents of mySysMonitor.sh
Used gedit mySysMonitor.sh and entered the following lines and saved the files.
# This command provide the information about the logged in users,
who
# To provide the users list currently logged in the machine.
users
#To see every device plugged to the system and then to see the mount point the df command is used.
df -h
#The lsblk command is used to view the name of the USB devices.
lsblk
#To know the disk space available for usage, disk size and disk space used and the percentage of disk
usage, the below command is used.
df -H
#To see the CPU information of Linux, use the below command
lscpu
#To collect the block device data of a Linux, use this command
lsblk
20
Giving permissions to mySysMonitor.sh
sudo chmod u+x mySysMonitor.sh
Editing the contents of mySysMonitor.sh
Used gedit mySysMonitor.sh and entered the following lines and saved the files.
# This command provide the information about the logged in users,
who
# To provide the users list currently logged in the machine.
users
#To see every device plugged to the system and then to see the mount point the df command is used.
df -h
#The lsblk command is used to view the name of the USB devices.
lsblk
#To know the disk space available for usage, disk size and disk space used and the percentage of disk
usage, the below command is used.
df -H
#To see the CPU information of Linux, use the below command
lscpu
#To collect the block device data of a Linux, use this command
lsblk
20
#To view the information of USB ports, Graphic Cards, Network adapters, use the below command.
lspci
#To get information about the BIOS, use the below command
dmi decode -t bios
#Adding date and time
date
The script is attached here
21
lspci
#To get information about the BIOS, use the below command
dmi decode -t bios
#Adding date and time
date
The script is attached here
21
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Create a log file
sudo ./mySysMonitor.sh > mySysMonitor.log
Automating the script
Crontab is used for automating the script
Created autolog.sh script , gave permissions.
sudo touch autolog.sh
sudo chmod u+x autolog.sh
gedit autolog.sh
./mySysMonitor.sh > mySysMonitor.log
Finally made the following entry in the crontab. This will run autolog.sh file at exactly 14:30 PM
30 14 * * * /home/autolog.sh
HTML Report Creation
Created html output for only file system usage (Used df –h command ). The output file can be
mySysMonitor.html and it can be viewed if the system is running a webserver
22
sudo ./mySysMonitor.sh > mySysMonitor.log
Automating the script
Crontab is used for automating the script
Created autolog.sh script , gave permissions.
sudo touch autolog.sh
sudo chmod u+x autolog.sh
gedit autolog.sh
./mySysMonitor.sh > mySysMonitor.log
Finally made the following entry in the crontab. This will run autolog.sh file at exactly 14:30 PM
30 14 * * * /home/autolog.sh
HTML Report Creation
Created html output for only file system usage (Used df –h command ). The output file can be
mySysMonitor.html and it can be viewed if the system is running a webserver
22
The script is attached below
5. Conclusion
23
5. Conclusion
23
The GNU/Linux bash script is created for monitoring a computer system, user activity
continuously and logs key information. The GNU/Linux bash script is created to automatically
write the log file with date and time. The log file is needed to provide information of current
processes of system, users currently logged in the system, Devices plugged in the system that are
USB, Disk usage of the system such as user’s home directory, overall disk usage and other key
directories, network interfaces and the states of network and login time of the users, the
applications installed in the system. The best version of Linux that is Ubuntu 16.04 is installed
for doing the assignment. The required commands are provided to perform the given task. The
script file is created for doing the required task with given command.
References
A Practical Guide to Ubuntu Linux?. (2011). Prentice Hall.
Abbott, D. (2013). Linux for embedded and real-time applications. Waltham, MA: Newnes.
Blum, R. and LeBlanc, D. (2009). Linux for dummies. Hoboken, N.J.: John Wiley.
Chapelle, G. (2013). A practical guide to linux commands, editors, and shell-programming, third
edition by Mark G. Sobell. ACM SIGSOFT Software Engineering Notes, 38(4), p.38.
Dalheimer, M. and Welsh, M. (2009). Running Linux. Sebastopol: O'Reilly Media, Inc.
Deimeke, D., Kania, S., Kühnast, C., Semmelroggen, S. and Soest, D. (2012). Linux-Server.
Bonn: Galileo Press.
Lakshman, S. (2011). Linux shell scripting cookbook. Olton, Birmingham: Packt Pub. Ltd.
Makan, K. (2014). Penetration Testing with the Bash shell. Packt Publishing.
Negus, C. (2013). Ubuntu Linux Toolbox. New York, NY: John Wiley & Sons.
Negus, C. and Bresnahan, C. (2012). Linux bible. Indianapolis IN: Wiley.
Raggi, E. (2011). Beginning Ubuntu Linux. New York, NY: Apress.
Smith, R. (2012). Linux essentials. Indianapolis, Ind.: John Wiley & Sons.
24
continuously and logs key information. The GNU/Linux bash script is created to automatically
write the log file with date and time. The log file is needed to provide information of current
processes of system, users currently logged in the system, Devices plugged in the system that are
USB, Disk usage of the system such as user’s home directory, overall disk usage and other key
directories, network interfaces and the states of network and login time of the users, the
applications installed in the system. The best version of Linux that is Ubuntu 16.04 is installed
for doing the assignment. The required commands are provided to perform the given task. The
script file is created for doing the required task with given command.
References
A Practical Guide to Ubuntu Linux?. (2011). Prentice Hall.
Abbott, D. (2013). Linux for embedded and real-time applications. Waltham, MA: Newnes.
Blum, R. and LeBlanc, D. (2009). Linux for dummies. Hoboken, N.J.: John Wiley.
Chapelle, G. (2013). A practical guide to linux commands, editors, and shell-programming, third
edition by Mark G. Sobell. ACM SIGSOFT Software Engineering Notes, 38(4), p.38.
Dalheimer, M. and Welsh, M. (2009). Running Linux. Sebastopol: O'Reilly Media, Inc.
Deimeke, D., Kania, S., Kühnast, C., Semmelroggen, S. and Soest, D. (2012). Linux-Server.
Bonn: Galileo Press.
Lakshman, S. (2011). Linux shell scripting cookbook. Olton, Birmingham: Packt Pub. Ltd.
Makan, K. (2014). Penetration Testing with the Bash shell. Packt Publishing.
Negus, C. (2013). Ubuntu Linux Toolbox. New York, NY: John Wiley & Sons.
Negus, C. and Bresnahan, C. (2012). Linux bible. Indianapolis IN: Wiley.
Raggi, E. (2011). Beginning Ubuntu Linux. New York, NY: Apress.
Smith, R. (2012). Linux essentials. Indianapolis, Ind.: John Wiley & Sons.
24
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Thomas, K., Thomas, K. and Vugt, S. (2011). Beginning Ubuntu Linux. New York, NY: Apress.
25
25
1 out of 26
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.