Skip to content

Purdue-CS193/CS193HW1

 
 

Repository files navigation

CS 193 Homework 1 - Terminal

Terminal_Icon

What is this assignment?

For this assignment, you will be making a basic shell script to make some changes to a file system. A shell script is a useful tool for running multiple terminal commands sequentially. For this assignment, all your answers will be placed in the answers.sh file.

When is this due?

Refer to BrightSpace for the assignment due date.

When will I know that I am done?

  • You will be finished with the assignment when you have a functional SINGLE COMMAND for each of the 11 tasks in your answers.sh file.

  • In order to test your commands, run bash -i grader.sh in a terminal. This program will let you know which command is not functioning properly.

    • Please note that the grade you receive with the bash -i grader.sh is not your guaranteed grade on homework 1. Your TA will still go through your commands to ensure that you only use a single command for each of the tasks.

Notes on repository visibility

Starting homework 1, all homework repositories must remain private. Besides homework 0, every homework repository for CS193 will ship as private by default, and you will receive 0 on the assignment and be subjected to academic dishonesty if you change them to public. DO NOT CHANGE THE VISIBILITY SETTING!! Homework 0 is the only homework repository that should be public. If you are unsure about the visibility setting, do not hesitate to talk to one of the instructors after a lecture!

Getting Started

  1. Generate a personal access token
    Visit https://github.com/settings/profile and go to Developer settings --> Personal access tokens

Image description: Under the Personal access tokens page, in GitHub settings, there is a red box around the "Generate new token" button

Select the appropriate scopes for your token. Please make sure you select repo as this gives you access to write, read, etc. with public and private repos. Feel free to select all the scopes just in case you might need them in the future.

Image description: A list of possible scopes for a new personal access token. All of the options are selected for the token, "My token".

  1. Open a terminal window

    • Windows: Open up PowerShell

    • Mac & Linux: Open Terminal

    • If you are having issues, it might just be easier to use a lab machine in Lawson or Haas

  2. Click the green "Clone or download" button on this GitHub repository and copy the URL. Make sure you are using the option "Clone with HTTPS".

  3. Open up your respective terminal application and run ssh purdue_username@data.cs.purdue.edu. Replace "purdue_username" with your Purdue alias (A.K.A. Purdue username, <this-portion-of-your-purdue-email>@purdue.edu. It will prompt you to enter your Purdue password.

  4. Run git clone URL, replacing the URL with what you copied in step 2. (It will ask for GitHub credentials)

  5. Run cd homework-1-USERNAME, replacing the USERNAME with your username (eg. "ahn99") to navigate to the directory with our answers.sh worksheet

  6. Run ls and make sure you see answers.sh. Don't worry about any other files for now.

  7. You are ready to go! Start typing your answers in answers.sh. To edit answers.sh type in either vim answers.sh or nano answers.sh. Use the editor that you prefer.

  8. Take a look at the Terminal_Guide.md file in the repository. This document reviews the content found in the lecture. Everything you need to complete this assignment can be found there.

Important Notes!!!! (Please read!!!)

ALL COMMANDS SHOULD BE FROM THE ORIGIN DIRECTORY!!!!!

For instance mv Hello.java Hello2.java would not be an acceptable answer for renaming Hello.java to Hello2.java, since there does not exist Hello.java in the ORIGIN directory. Instead, the proper answer would be mv Programs/Hello.java Programs/Hello2.java.

EVERY ANSWER SHOULD ONLY BE A SINGLE COMMAND!!!!!
Please note the difference between a chain of commands and a single command

Chain of Commands:
mv Example/Count.java Example/Java/Count.java && mv Example/Hello.java Example/Java/Hello.java
Single Command:
mv Example/*.java Example/Java

Tasks

Task 1

Rename Homework/MA165/HW2.txt to HW1.txt.

Task 2

Delete Memes/SpongeBob/money.jpeg (it wasn't funny enough to make it into the Memes folder).

Task 3

Move fafsa.jpg from the Star Wars meme folder to Memes/SpongeBob (SpongeBob memes don't belong in the Star Wars folder).

Task 4

Delete the Homework/CS191 directory. Hint: please refer to the rm section of the Terminal Guide if you're stuck

Task 5

Make a new directory in Programs called C++.

Task 6

Move Programs/Age.cpp to the newly created C++ directory made in Task 5.

Task 7

Copy the Programs/Java directory into the Homework/CS180 folder, while renaming the copy to Project_1.
Hint: please refer to the cp section examples of the Terminal Guide for help
The copied directory should have a relative pathname of "Homework/CS180/Project_1"

Task 8

Move Programs/Count.c and Programs/Goodbye.c to the Programs/C directory.

Task 9

Move Programs/Name.py and Programs/Space.py to the Python 3 folder in the Programs directory.

Task 10

Make a new file in Homework/POL141 called Essay.txt.

Task 11

List the files and directories above the current working directory.

Task 12

Vim or nano customization! If you haven't made any customization yet, you'll find that the vim/nano text editor isn't debugging/readability friendly. By editing your ~/.vimrc or ~/.nanorc file, you can create a more readable and friendly text editor! Please list at least 3 commands you added to your ~/.vimrc or ~/.nanorc file. Please refer to Terminal_Guide.md for more details.

Optional (Just for Kicks 🙃): Creating an SSH shortcut

NOTE: This part is not for any points, strictly optional

It can be tedious to remember different usernames, hostnames, IP addresses, and sometimes even custom private keys to connect to them. There are 2 methods you can choose for creating an SSH shortcut: using SSH Config or creating aliases for your shell. Please refer to SSH_Shortcut.md for instructions.

Turning In

  1. Make sure all your commands are saved in answers.sh!

  2. Run ./turn-in.sh (it will ask for your GitHub username and password)

  3. Verify that your answers have been submitted by opening your GitHub repository online and checking the answers.sh file.

  4. You are done! Yay!!!

Rubric

Task Points
Task 1 1
Task 2 1
Task 3 1
Task 4 1
Task 5 2
Task 6 2
Task 7 2
Task 8 2
Task 9 2
Task 10 2
Task 11 2
Task 12 2
Total 20

FAQ

How do I reset my ORIGIN directory?

Simply run ./clean.sh. This will reset your ORIGIN directory without deleting your answers in answers.sh. It is like nothing ever happened!

NEED HELP?

Take a look at the Terminal_Guide.md file in the repository. This document reviews the content found in the lecture. Everything you need to complete this assignment can be found there.

Try different things by typing out commands in the terminal. It is okay to mess up. Simply run ./clean.sh to revert any changes. The best way to learn is to experiment!

If you need extra help, ask a TA, ask on the Ed Discussion, or Google around. DO NOT COPY FROM ANOTHER STUDENT

About

Homework 1 - Terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 55.7%
  • Java 20.9%
  • Python 11.5%
  • C 6.2%
  • C++ 5.7%