Project 0: Linux basics
-
This project is due at 11:59.59pm on Monday, September 16, 2024.
-
Pre-requisite: Setup your gradescope account.
Goals
- Use a linux environment on your computer via Cloud shell and become comfortable with manipulating files.
- Learn to submit your work.
Description and Deliverables
This class has projects that require the use of the command line. Since different OS’s have different command line environments, we will use Ubuntu 22.04 via Google cloud shell as a concrete example for the whole class.
Even if you already have a bash command line (e.g. you use Linux, own a Mac, or have installed WSL on Windows 10) for this project we ask that everyone complete the following steps in full. Later on, you can use your own environment if you like.
Steps to Complete The Project
To receive full credit for this project, complete the following steps. Ultimately, you will create a git project for your course files, and submit three files that you produce during these steps as a commit to your repository.
-
If you don’t already have an account on Github, you will need to get one. You can sign-up for one at Github.
-
We will now create a git repository in your Github account that will hold all of your cy2550 Project files.
- Click on
Create a Repository
in your Github account, in Repository Name, usecy2550
, select Visibility levelPrivate
and select “Initialize repository with README.” Click “Create project”. You should see a Github repository page now.
- Click on
-
You will perform all of the work for this project using Google’s cloud shell, which you can access from this link. For this to work, you will need to have already created your GCP account using the link to redeem your educational credits that was emailed to you before the first lecture.
-
From the terminal, install the
git
and thescreenfetch
program using theapt
tool. You can think ofapt
as the app store for Ubuntu: it lets you install new programs from the command line. Of course, to do this you need administrator privileges, so you also need to use thesudo
command. Putting it all together, execute the following command:$ sudo apt install screenfetch git
-
Now
checkout
your newly created git repository.-
First, you will need to create a personal access token by clicking on your user profile picture in the upper-right corner of the Github page, then clicking “Settings”, scrolling to the bottom and clicking “Developer settings”, and finally “Personal Access Tokens–>Fine-grained tokens”. Click “Generate New Token.” Give your token a name, set the expiration to 90 days, under “Repository Access”, choose “All Repositories”, under “Repository permissions,” set “Actions” to be “Read + Write”, under “Contents”, select “read and write” and finally, click “Generate Token”. Copy the resulting token string, and keep it safe. You will need it until we can setup
ssh
access to your account in Project 2. -
Next, go back to the Github repository page, and click the “Clone” button. Under
Clone with HTTPS
, copy the URL and then run these commands:
$ git clone <copied url, e.g. https://github.com/<your username>/cy2550.git>
The prompt will ask you for your Github credentials. Use your username, and then pasete the string that you copied from the previous step as your password. Again, you need to save this string somewhere so that you can use it again.
-
-
Make a new directory for
project0
, and then enter this directory$ mkdir -p ~/cy2550/project0 $ cd ~/cy2550/project0
mkdir
is a program that makes directories (i.e. folders) on the hard drive. The tilde character is a shortcut that always refers to your home directory (typically/home/<your_username>/
). -
If you run the
screenfetch
program, it will print out useful information about Ubuntu and your system. Runscreenfetch
again, but redirect the output (using the > operator) to a file on disk namedsf-output.txt
. Make sure you remember where you saved this file, you will need it again! -
Run the
ps -ef
program, and redirect the output to a file namedps-output.txt
. -
In your same
project0
directory, create a file namedhello.txt
on your Linux machine (using a text editor of your choosing, such as Emacs, VIM, or Nano). This file must contain your full name Github username exactly in this format:Hi, my name is abhi shelat and my Github user name is abhvious.
The grader will strictly enforce that your file follows this template.
-
At this point, your
~/cy2550/project0
directory should contain three files. You can use thels
program to list the files in this directory to make sure. Make sure that your files are reasonably sized. No file should be more than 10kb in this assignment. -
You are now ready to
commit
andpush
your files to your Github repository.
Throughout these steps, you will be using various Linux command line programs. Most programs have built-in help messages if you run them with “–help” or “-?” as the command line argument. Furthermore, all programs have helpful Manual Pages that you can access by running:
$ man <program_name>
These various sources of help text may be useful if you get stuck during the project.
Learning the Linux Command Line
TA Martin Petrauskas has put together a helpful guide that explains how to setup VirtualBox (including how to change several important settings). This guide also has several chapters on basic Linux command line usage that may prove useful throughout this course if you are unfamiliar with the Linux command line. The guide is a work-in-progress, and the latest version is: Learning the Linux Command Line
Submit Your Project
-
We first need to do some setup to tell git who we are:
$ git config --global user.name "abhi" $ git config --global user.email "abhi@neu.edu"
-
Then we can prepare our commit. If you are already in the
~/cy2550/project0
directory, then you can do the following$ git add sf-output.txt ps-output.txt hello.txt $ git commit -m "Initial commit to project 0"
The first command tells
git
that the three files listed should be part of a “commit.” A commit represents a change to the state of the repository. It can include new files, modified files, or deleting of files from the state of the repository. In this case, we are adding 3 new files to the repository.The second command formalizes the change of the state your local git repository. The
-m
flag gives a short informative message that describes this commit.You can make as many changes as you like to your local repository in this way. When you edit larger pieces of software, it is important to make incremental commits as you develop a solution. For example, if you decide to edit the
hello.txt
file, and want to not reflect the new state:$ git add hello.txt $ git commit -m "Edit to hello.txt"
-
Finally, when you are ready, you need to
push
this local commit to Github:$ git push
This command will ask for your Github credentials. Pushing the local commit shares it with us. We can now see this change. This is how some large software projects manage collaboration across thousands of developers working on different parts of the system, while keeping a consistent view of the latest changes.
-
You can now return to your Github repository webpage to check that your files are now there.
To turn-in your project, you must submit exactly three files in a commit:
sf-output.txt
ps-output.txt
hello.txt
the format and specification of which are described above. All files should be placed in the directory cy2550/project0
.
- Go to gradescope and submit your assignment.
-
Select the appropriate assignment and then choose Github as the submission method.
-
The first time you submit your repository, you will need to authorize Gradescope to access your git repository. Select the appropriate repository and master branch, these should be of the form
username/cy2550
and branchmain
. -
You can submit multiple times before the deadline. Your last submission will determine your grade.
-
Once assignments are completely graded, you will be able to see your grade and assignment feedback on Gradescope.
Grading
This project is worth 5% of your final grade, broken down as follows:
- 33 points - producing a sf-output.txt file that gives your OS as Ubuntu 22.04 or Debian 10 Buster.
- 34 points - producing a correct ps-output.txt file.
- 33 points - submitting a hello.txt file that contains your name and Github username.
Note, we use an automated script to perform grading. If you do not create files and directories with exactly the stated names, our scripts will not find your work, and will not be able to grade it.