Primary Learning Objectives
- Use Unix shell commands to conduct work such as file management, search operations, etc.
- Access machines remotely using SSH.
Requirements
Part A
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 commands man page, or search online), but you should not need any commands that we didnt already cover in lecture or lab.
Question 1
Give a series of commands that will:
- Create a blank file called txt
- Create an empty subfolder called folder
- Put a copy of 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 10 marks
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 4
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: Youll 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
- 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.
- X would not match o XXX would match
- 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
- ALERTX would not match o ALERTY would not match
- 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>
<title>CS1XC3 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 20 marks
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. (Do not attach additional files to your submission, you can just put the file contents in your regular submission file).
This assignment is marked out of 100 total, see individual questions for the weight of each. If your grade exceed 100 marks due to the bonus question, you will receive 100 marks total (though of course, answering the bonus question can help ensure you reach 100 marks total).

![[Solved] CS1XC3 Assignment #1 Shell Interactivity and SSH Basics](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] CS1XC3 Assignment #5 typedef, struct and realloc()](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.