It is possible to use your VM without using VS Code. This page is a general outline of how to do that.
In all code examples below,
NETID
should be replaced by your NetID (e.g. luthert
)VMNAME
should be replaced by your virtual machine name (e.g. fa24-cs340-987.cs.illinois.edu
)Write your code on your own computer.
Copy it to the VM by running
scp -r file1.py file2.py entiredirectory/ NETID@VMNAME:~/
~/
means home directory
, the place you start when you log in to the VM. If you want them to be copied into a different directory on the VM, append that to the command (e.g. NETID@VMNAME:~/mp7/
)
Log into your VM by running
ssh NETID@VMNAME
If needed, cd
into the correct directory (e.g. cd mp7
)
Run commands on the VM (e.g. python3 chunkserver.py
)
Log into your VM by running
ssh NETID@VMNAME
Retrieve starter code using wget
{man1} and unzip
cd
into the starter code directory
Use nano
to edit files (e.g. nano chunkserver.py
)
nano
has a hint on common commands on the bottom lines. Some notable exceptions from other editors:
The mouse doesn’t work.
Exit nano
with Ctrl+X
There’s no copy; instead you cut with Ctrl+K and paste with Ctrl+U. To copy, cut then paste.
This copy is internal to nano
; your terminal might have separate mouse-oriented copy-paste, but nano
’s built-in one only works in nano
.
Ctrl+W is search, and after searching Alt+W is find-next.
Alt+U is undo, Alt+E is redo.
Why nano
?
There are many terminal text editors. None of them seem entirely familiar to people used to GUI text editors because (1) terminal programs have no built-in notion of the mouse and (2) terminals use common GUI keyboard shortcuts like Ctrl+C and Ctrl+Z for process management. Working with any terminal editor feels different than working with common GUI editors.
The most popular terminal editor is vi
an its derivatives. These have a mode-based design: when you are in editing mode keys do different things than when you are in viewing mode or replacing mode. Once you learn and internalize the modes, this makes a wide variety of tasks easy to do, but initially it feels confusing: being in a mode you are not familiar with can make the entire editor seem unresponsive or possessed by a malign spirit.
Historically, emacs
was vi
’s main competitor. With built-in file browsers, scripting, and other powerful tools it was arguably more an IDE than a simple editor. As the remainder of the terminal program ecosystem matured, more and more emacs
features were seen as redundant, but they were still present and started to become attractive targets for hackers^[One of the first books documenting malicious hacking, Cliff Stoll’s The Cuckoo’s Egg, had documents hackers using emacs as an attack vector). Emacs still has some users, but is strongly out of fashion today and is not widely installed.
There are terminal editors that mimic common GUI key commands closely, at the expense of not playing nicely with other parts of the terminal. There are also terminal editors that respond to the mouse as expected, but only if you are running certain families of terminal programs on certain operating systems. Because of those limitations, they are not widely installed.
nano
is currently the leading terminal editor that tries to just edit files, no extra features, using only universal terminal functionality, with keyboard shortcuts that people trained on GUI editors find familiar and/or easy to learn. There are other options in this space, but nano
is much more widely installed; It is so widely installed that it’s generally a safe bet that any server you ssh
Run commands on the VM (e.g. python3 chunkserver.py
)
Submit your code using the submitcode.sh
script bundled with each MP, or by copying it back to your computer by running the following from your computer:
scp -r NETID@VMNAME:~/your_directory_name ./