Introduction to Linux - CPSC 213
Introduction
For the fall term of 2020, I will be a TA for CPSC 213, an introduction to Computer Systems.
I have TAed this course three times before, and since this term will be the first fall term the course is held online, I have been thinking hard about the troubles that students may face, and what I could do as a TA to make it easier.
CPSC 213 is typicaly the first time students are expected to use a Linux development environment. This is often overwhelming for students, especially the “terminal” side of things. Before CPSC 213, students are used to using an IDE, which would contain the compiler, the debugger, the code editor and everything else that the student would need. Now however, students have to start using Linux environments, which includes interacting with a command line.
I decided to take a crack at creating some material that can help the students setup faster, and overall have a nicer experience. This blog post is meant for them, so if you’re one of the students taking CPSC 213, this is for you! For everyone else, feel free to read on if this is useful to you 😄
I also uploaded a video describing the content of this post, here’s a link to the video.
You can also find the slides here
What is a Linux environment?
Linux is a family of operating systems. Windows and MacOS are operating systems, and the operating systems in the linux family satisfy the same essential use case!
Why should I care about Linux?
The majority of “servers” are running Linux operating systems. There are multiple reasons for this, but I’ll leave that for you to look up 😉. The implication of that is that the software you develop must run on a Linux server!
Hold up, what the heck is a server?
A server is a fancy word used for a computer that is typically somewhere else. You generally connect to servers remotely - And we’ll explain how you do that in a bit - and from there you can let your server do a variety of things (You can run a website for example).
Why are you telling me this?
Well, in CPSC 213, most of your development will be tested on the department’s servers, which run - you guessed it! - Linux. This means that you will be expected to do your work in a Linux environment, and hand-in your work in a Linux environment!
Okay, how can I get one of those?
Well lucky for you, the CPSC department has a Linux server with your name on it!
And all you need to access it is an ssh
client. There’s some explanation on exactly what that is in this wikipedia page, but you don’t need to know all its ins and outs to get started.
All you need to know is that ssh
is what is used to access a remote server and run a terminal there. You’ll also need an SFTP
client to easily transfer files, but we’ll get to that in a bit.
There are a few ssh
clients out there you can get, I’ll break it down by your operating system and I’ll also write my Tarik Approved
recommendation after.
Windows
If you are running windows, a commonly used tool for students is Xmanager
, it includes an ssh
client called XShell
and an SFTP
client, called Xftp
. You can follow instructions on how to download it for free as a student in this CS website
Mac
If you are on a Mac, you should have an ssh
client active by default. You can try this out by typing on a Terminal
(You can get a terminal by searching Terminal
in you Mac search bar):
|
|
And you should get an output that looks like this
|
|
You might want to however install an SFTP
client, and CyberDuck
and FileZila
are commonly used ones.
Tarik’s Recommended
If you are like me, and don’t want to install a billion things in order to get some work done I have the thing for you!
VS Code is a code editor that you can use to… edit code! The cool part is that VS Code supports almost every programming language, and has an awesome extension that allows you to connect directly to a remote server. Here are the steps to setting it up:
- Download VS code form the link above
- Run VS code
- Download the following VS Code extension
- You might need to restart VS Code, but you’ll now see a new logo on the left side of VS code that says “Remote Explorer”, click on it
- Make sure your are on
ssh Targets
and click the âž• sign. - Insert the following command:
|
|
- You will be asked to input you password, once you do that, it will direct you to open a folder, pick the home folder.
- Celebrate because you just connected to your first Linux remote server!
Lets learn Linux!
Okay so that was a lot to take in, so it’s okay if you had trouble going through it or still are missing a few pieces. TAs are there to help and if you have ANY questions, we would love to help guide you!
Now that you have access to the server, it’s time to learn the most important linux commands! (Note that the $
denotes the start of a command)
cd
: short for “Change directory” changes your current directory to which ever one you pass to it, with.
being the current directory and..
being the parent directory. Example:
|
|
ls
: Lists files and directories, for example
|
|
pwd
: Print working directory, prints the path to where you are right now
|
|
cat
: short for concatenate, it lists the contents of a file
|
|
cp
: copies a file from one place to another
|
|
This should be enough for you to move around and inspect your linux environment!
What you need for 213
- A folder named
cs-213
in your user’s home directory. You can do that by running:
|
|
- A folder named
a1
for assignment 1,a2
for assignment..etc
|
|
From there, you should be able to run the handin
command! Which is what we use in CPSC 213 to hand-in your assignments. Here’s how you run it:
|
|
or if you want to overwrite an existing submission:
|
|
Each assignment will include a list of deliverables that you will place inside the aX
folder (where X
is the number of the assignment)
Wrap up
There are a few omitted details, so if you have any questions please feel free to ask a TA, and feel free to send me an email at tarikesh@student.ubc.ca
.
I hope this helps save you a bit of time, and can act as a referrence as you progress through the course.
I might write another one of those with more details if the need arises, but for now, happy coding!