How To Monitor Computer System And User Activity With A GNU/Linux Bash Script
How to install the GNU/Linux
In this project, the installation of GNU/Linux will be described. And the usage of bash script will also be described. The detailed discussion will be made regarding the Linux base system and shell script. Next, the Linux commands will be described clearly regarding the creation and usage of bash script in the Linux system. And the justification will be provided for each process. Next, the test results will be delivered with the screenshots. The script file and log files will be created. Then the advantages and disadvantages of shell script will be explained. Here the bash script could be used to display the activities and usage of the system. This bash script automatically will create the log file to monitor the system activities. Also, this log file will deliver the details regarding the overall disk usage, plugged devices, user home directories, and network interfaces (Nieh and Vaill, 2005).
Generally, the Linux is kind of operating system. Mostly for the graphical user interface, Ubuntu version is considered as the best choice. It is an open source platform. Also had some security measures. Here the installation of Linux will be described. The operating system could also be installed through the VMware. The basic procedures are added below to make the installation process (Apte and Rungta, 2007) (Serral and Gil, 2004).
- First, enter into the windows and click the start button
- Then click the control panel -> Disk management. This page will lead the disk management and partitioning.
- Next, the volume needs to be selected and make shrink to provide the storage level to the chosen operating system.
- After that, the corresponding operating system file needs to boot for the installation. So it will take a time.
- Next, the system should be restarted for installing the additional operating system. While restarting the boot menu options need to be clicked.
- Next, select the Linux based operating system such as Ubuntu and click install (Introducing Ubuntu: desktop Linux, 2008).
- Then choose the language and other features regarding the OS installation (The GNU Make Book, 2015).
- Make the partition regarding the usage in the Linux system
- Click the continue button for proceeding the installation (LITAYEM, BEN and BEN, 2011).
- Finally, the Linux system will be obtained by the user (Koren, 2006).
Bash shell script
The bash shell is represented as Bourne again shell. Mainly it is distributed with the Linux operating systems. Also, this bash script is represented as a plain text. And the plain text includes a series of commands. The bash script is considered an easy way to make the execution instead of working with the command line (Chapelle, 2013). The extension of bash script is ‘.sh’. This bash script also used to system administration and remote access. This script usually read the commands by the log file. In this project, the bash script will be created to find the usage of disk and processes. Also, the network services and logged users will be identified by the script file execution (Davoli, 2004).
This section includes the creation of usage of shell script. And the commands will be described. Also, the justification will be provided for using the bash script. The shell script is represented as a computer program. It is used to scripting the sequence of commands regarding the process. Also, these script files could be stored at any time. The creation of bash script is described below (Haryanto and Ginting, 2016).
Constructing the shell script
The step by step procedures are listed here to make the shell script. They are,
- Initially the text editor ‘Nano’ or ‘vi’ is used for creating the script file. With the name of script file the editor command is used to make the file (Linux infected by Remote Shell Trojan b, 2002).
- And save the file for further procedure. Next create the script regarding to find the plugged devices, logged users and disk usage.
- Then the script need to run with the ‘sh’ command at the end.
- And the script need to be tested.
- Next the script should be moved to another environment after getting the corresponding output.
Uses of scripts
Actually, the shell script takes inputs from the user. According to the feedback the file and output will be shown in the command line. Also, it is used to make own commands. Then by the using shell scripts, we can save more time (Walfield and Brinkmann, 2007). Because it is easy to process instead of working with the command line. By default, the administration portion is automated regarding the system. Also, it had many types of shell. In that, we have used Bourne again shell. It seems to be common for all Linux based systems (Saha, Lawall and Muller, 2012).
Bash shell script
Normally the shell script seems to be easy for handling and usage by the user. Instead of entering the command in the terminal we can easily execute the file through the bash script. Basically, it contains a series of commands for the execution. So here the script is used for the process of finding the logged users and disk usage. It displays the output through the log file. So it could be easy to store and view the corresponding output. Hence these are the reasons are supporting for the usage of shell script to make the process execution (Tsegaye and Foss, 2004).
Commands
top – Show the system current process
ls –l – Shows the list of files for the existing directory.
whoami – This command shows who is currently accessing the system.
Vi or Nano – used to create the script file.
.sh- Adding this command at the end for the execution.
df –h – Disk usage
du –h /home – Disk usage for the home directories.
lsusb – Plugged devices
ls –A sys/class/net – finding the network interface
- Current process
- Currently logged on users
- Plugged devices
- Disk usage (overall)
- Disk usage (user home directories)
- Network Interfaces
- Username and current date && time
Advantages and disadvantages of shell scripting
Advantages
Generally, the creation of shell script seems to be easy to manage and handle. And by using this shell script we can get the execution results easily. And we can save more time by using this script instead of using command line execution. Because the shell script keeps the series of commands. It could be written by the intercepted language by the user. So it could be executed without any modification. The shell script is considered as an interactive shell script. Also, it can be run the bunch of commands in a single execution (Jardim and Pinto Júnior, 2010).
Disadvantages
But this shell script also had some drawbacks regarding the execution. First thing is the execution speed seems to be slow when compared with other kinds of programming languages. Then each time the process should be initiated for the shell execution. The compatibility issues may increase by the usage shell script (Zhao et al., 2017).
Conclusion
The detailed discussion is made regarding the GNU/Linux operating system. Also, the installing procedures are described. The explanation of bash script is provided. And then the design consideration is made regarding the shell script. The creating procedures are explained for the shell script. The commands are described. And also the usage of shell script also described along with the design consideration. The test results are shown with the screenshots. The final output is delivered regarding the logged users, disk usage, plugged devices and another kind of network services. The pros and cons of the shell script are described.
References
Apte, H. and Rungta, M. (2007). Adding parity to the Linux ext3 file system. ACM SIGOPS Operating Systems Review, 41(1), p.56.
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.
Davoli, R. (2004). Teaching operating systems administration with user mode linux. ACM SIGCSE Bulletin, 36(3), p.112.
Haryanto, E. and Ginting, R. (2016). Pembuatan Administrasi Users Account Shell Linux Menggunakan PHP. SISFOTENIKA, 6(1).
Introducing Ubuntu: desktop Linux. (2008). Choice Reviews Online, 45(06), pp.45-3239-45-3239.
Jardim, A. and Pinto Júnior, J. (2010). Shell script na Prática. Cadernos de Educação, Tecnologia e Sociedade, 2(1).
Koren, O. (2006). A study of the Linux kernel evolution. ACM SIGOPS Operating Systems Review, 40(2), pp.110-112.
Linux infected by Remote Shell Trojan b. (2002). Network Security, 2002(2), pp.3-4.
LITAYEM, N., BEN, A. and BEN, S. (2011). Building XenoBuntu Linux Distribution for Teaching and Prototyping Real-Time Operating Systems. International Journal of Advanced Computer Science and Applications, 2(2).
Nieh, J. and Vaill, C. (2005). Experiences teaching operating systems using virtual platforms and linux. ACM SIGCSE Bulletin, 37(1), p.520.
Saha, S., Lawall, J. and Muller, G. (2012). Finding resource-release omission faults in Linux. ACM SIGOPS Operating Systems Review, 45(3), p.5.
Serral, R. and Gil, M. (2004). A Linux networking study. ACM SIGOPS Operating Systems Review, 38(3), pp.1-11.
The GNU Make Book. (2015). Network Security, 2015(5), p.4.
Tsegaye, M. and Foss, R. (2004). A comparison of the Linux and Windows device driver architectures. ACM SIGOPS Operating Systems Review, 38(2), pp.8-33.
Walfield, N. and Brinkmann, M. (2007). A critique of the GNU hurd multi-server operating system. ACM SIGOPS Operating Systems Review, 41(4), p.30.
Zhao, Y., Zhao, X., Zhang, S., Gao, Z., Yang, Y., Fang, T., Wang, Y. and Zhang, J. (2017). A short unix shell script for vcftools commands iteration to obtain the genotypes of variations for forensic purpose. Forensic Science International: Genetics Supplement Series, 6, pp.e49-e51.