bash scripting, knowledge on linux
ITEC325-MockMidTerm.docx
Section 1: True/False, (1 point each)
1. Run level 6 means the system is in the process of rebooting. _______
2. Any user can create a device file in Linux. _______
3. MD5 is the default hash algorithm on UNIX and Linux systems. _______
4. Every user’s password is hashed and stored in the etc/psswd file. _______
5. A user’s personal information is stored in the gecos field of the etc/psswd fle. _______
6. Storage Area Networks are designed for file sharing. _______
7. Zombie processes can only be stopped with a kill command. _______
8. Modern storage hardware no longer use parallel interfaces. ______
9. The command: chmod 777 <file> would set <file> permissions to allow anyone to read, write & execute <file>. _______
10. The “init” process is an ancestor of every user process. _______
11. If run from the root account, the command: ($ telinit 0) would shut the system down. _______
12. The shell command ($ rm –r <file>) leaves <file> data in a recoverable state. _______
13. The Pre-boot Execution Environment refers to empty real memory prior to the start of a boot up cycle. _______
14. The SysLog daemon (syslogd) alerts the root user whenever any system kernel error conditions occur. _______
15. Piping ( | ) connects the STDOUT of one shell command to STDIN of another command. _______
Section 2: Short Answer, (2 points each)
1. What file system is currently used for file sharing on UNIX/Linux systems? _________________
2. What storage option and level provides multiple copies of stored data? ___________________
3. A process that is waiting-to-die but cannot, is called what? ______________________________
4. What is the effect of the command: $ killall billyBob (2 possibilities, assuming that billyBob is a regular user) ___________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________
5. Short Answer: (4 points) List 4 things that only root can do. ____________________________ ______________________________________________________________________________ ______________________________________________________________________________
6. What command is used to make a script file executable? _______________________________
7. What is the highest error-level in a system log-file? ____________________________________
8. There are two device files associated with each backup device. What is the difference in functionality between these two files? ________________________________________________________ ______________________________________________________________________________
9. What type of hard-drive includes built-in diagnostics (SMART diagnostics) that can be used to predict imminent drive failure? __________________________________________________________
10. What protocol is used by Storage Area Networks? _____________________________________
11. BACULA is a 3rd party freeware application for what network function? ____________________
12. List two ways that scripts can be automatically run on a Linux system. _____________________ ______________________________________________________________________________
13. What BASH shell command is used to setup and initiate a backup? _______________________
14. What is the difference between a Character Device File and a Block Device File? ____________ ______________________________________________________________________________
15. The command ($ kill -9 <processID> will instantly kill a running process, what is the difference if you replace -9 with -3? ______________________________________________________________ ______________________________________________________________________________
Section 3: BASH commands and scripting
1) Create a BASH script that locates log files anywhere BELOW your home directory, and copies them into a new directory named logs, also located in your home directory. Your script should first create the logs directory, if it doesn’t already exist. (12 points) Hint: see page 39 of the textbook
2) Create a crontab file entry that would run the script from question 1 on the 15th of every 4th month, (April, August, and December) at 3 AM. Assume the script is at ~/scripts/logs.sh (3 points)
3) Create another script that has a local variable called searchFor which is set to your username. This script should use grep and the searchFor term to find lines in any file on or under your home directory that contain your username (grep) should use searchFor as a regular expression. (12 points)
4) What regular expression could you write into the searchFor variable of the previous question to find the three following users in the accounting department? ( Helen-acct, John-acct, Willy-acct) (3 points)
5) Write a regular expression would zip code + 4 fields of the forms: xxxxx-xxxx where x is any number but the last 4 digits could be missing. The dash at the end of the first 5 numbers will ALWAYS be present AND the field is delineated with spaces or tabs. (5 points)
Section 4: Short Essay, (10 points each)
1) Compare and contrast the most common hardware choices for a primary backup medium
2) Describe the major steps of the boot process.