$25
For each question below provide the Unix command or sequence of commands that when entered into a Bash shell will produce the desired result in the current working directory. You may need to research some specific information about commands beyond what we covered in the slides (e.g. use a command’s man page, or search online), but you should not need any commands that we didn’t already cover in lecture or lab.
Question 1
Give a series of commands that will:
1. Create a blank file called file.txt
2. Create an empty subfolder called folder
3. Put a copy of file.txt named filecopy.txt into the subfolder folder
Question 2
Give a single command that will print the operating system (i.e. kernel) version (and only the operating system version).
Question 3
Give a single command that will create all subfolders in this path of subfolders: /test1/test2/test3 in the current working directory. Assume that none of the subfolders in the path exist before the command is run. (Hint: check out the mkdir man page...).
Question
Give the single OpenSSH command for connecting to a server with the hostname mcmasterserver.com and the username lovelacea.
Question 5 –
On a remote computer with hostname mcmasterserver.com the user hopperg has a home directory with a subfolder named documents, which contains a file important.doc. On the local computer the parent directory of the current working directory has a subfolder named code.
Give a single command that will transfer the important.doc file on the remote computer to the code folder on the local computer.
Question 6 –
Write a single command that will find all occurrences of any of the following items contained in any file in the current working directory that ends with the extension .csv. Hint: You’ll want to use | as part of a regular expression.
• ERROR### where # is a digit between 0 and 5 o ERROR123 would match o ERROR945 would not match
o ERROR1239 would contain a match (the first 8 characters still match!)
• XXX, XXXX, XXXXX, XXXXXX, XXXXXXX, XXXXXXXX, XXXXXXXXX o In other words, between three and nine X characters in a row.
o X would not match o XXX would match
o XXXXXXXXXX - 10 X characters in a row would contain a match (the first 9 characters still match!)
• The text ALERT followed by 1 or more of any character that is not X or Y o ALERTA would match o ALERTABC would match
o ALERTX would not match o ALERTY would not match
o ALERTABCX would contain a match (the first 8 characters still match!)
Part B
Question 7
Using your account on pascal, create a folder called /public_html in your home directory. Place or create an HTML file called cs1xc3.html in the folder with the following content:
<html
<head
<titleCS1XC3 Assignment #1</title
</head
<body
<h1 MacID </h1
</body
</html
Where MacID is replaced with your MacID. The file should be accessible in a browser at the URL: https://pascal.cas.mcmaster.ca/~MacID/cs1xc3.html where MacID is your MacID.
After completing the above, provide this URL as your answer to this question, we will verify you have placed the file at this location by checking the URL.
Bonus
You do not need to complete this question, it is optional.
Question 8 –
Find a Unix shell command (which we did not cover in-class) that will identify the differences between the contents of two files. What is the command? Explain how the command works using an example