How to Work on a Lab Machine
Here's how to work on a lab machine!
We're assuming that you've already done the initial setup on the server, so all you need to do is connect and start working. If you haven't, follow the steps in Homework 0.
Log in to the Lab Machine
Log in to the lab machine as “Guest”.
The lab machines are Macs, and you will be using one as a way to reach the CS 70 server. Almost nothing you do happens on the machine in front of you.
Open a Terminal
Press Command Space,
type Terminal, and press Return. That is the
fastest way to get one, and it is worth learning because you will do it every
lab.
A window opens with a prompt in it, waiting for you to type.
Is this the same kind of prompt I get on the server?
Yes, and that is a genuinely useful thing to notice: your Mac is a Unix machine too, so almost everything on the Unix Basics page works in this window as well.
The difference is only which computer is listening.
Connect to the Server
In the terminal, type:
ssh username @cs70.cs.hmc.edu
where
The prompt will change to the CS 70 one, and from that moment everything you type is running on the server rather than on the Mac.
Open More Than One
Two or three terminal windows is a good way to work, and it is worth doing deliberately rather than discovering by accident. One window can sit in your editor while another compiles and runs, and you stop losing your place every time you switch tasks. Open a new one with Command N, and connect it to the server the same way.
Resist the urge to make them full-screen. A maximized window hides every other window, which is the opposite of what you want when the whole point is seeing your code and its output at the same time. Windows can be moved and resized and placed side by side; a screen is a desk, not a slide.
Meh, I'll just keep switching tabs.
You can, and you will spend the semester paying a small tax every few seconds for it.
If the compiler error is in one window and the code is in another, you can read them at the same time instead of remembering one while you look at the other.
That is exactly the reason, and it matters most when you are tired.
Nothing You Do on the Lab Machine Is Kept
When you log out of a Guest account, everything on that Mac's hard drive is erased. This does not matter, because your work is not on that Mac. It is in your home directory on the server, where it stays between sessions and is the same whichever lab machine you sit down at.
So there is nothing to tidy up, nothing to copy off, and nothing to lose by logging out — as long as the work you care about is on the server, and it is.
So I do not have to clone my repository again every time?
No. You cloned it once, into
~/cs70on the server, and it is still there.
That was true of the old way of working and is not true now, so if you have heard otherwise, this is the version to believe.
Get to Work!
You're logged in and you're on the server. From here:
- Finding Your Way Around the Terminal — moving around, finding your files.
- Surviving Helix — editing them.
- Using Git and GitHub — saving and sharing your work.
When you're finished, type exit to leave the server, and log out of the Mac.
(When logged in, completion status appears here.)