The following is a list of useful tools that you may find helpful while navigating your CS major/minor
If you have any tools you believe belong on this list, please email Ruben Gilbert
- 1 Notes on Style
- 2 Shell Commands/Tools
- 3 File System Resources
- 4 Application Managers
Notes on Style
In order to easily read this guide, you should be aware of the notation being used. A statement may read:
$ [user@my-machine ~]: command <variable> some/kind/of/path
The $ is simply denoting that this line is from a console window. In other words, the text following a $ should be read as though it were in a Terminal window.
The [ ] enclose a typical terminal prompt, which usually contains the name of the user @ the machine they are currently logged into.
The ~ is shorthand for home folder (and is generally the default location a console opens to). If you changed to a different directory, that ~ would become the bottom-level folder of your current path (e.g. if you are in /home/<username>/Documents/cs101, you would just see cs101).
The : will be followed by the command being referenced.
Any variable value that changes based on the user will be enclosed in < >. (e.g. when a command requires a <username>, we don't actually enter "<username>", but instead your username).
A command that requires some/kind/of/path will need you to specify a path for the command to run to/from. Generally speaking, the path can be relative or absolute
Secure SHell is a network protocol that allows remote console (i.e. terminal) login from one machine to another. The Middlebury CS department machines all support SSH from the on-campus network. In addition, there is one machine (basin) that is specifically given a hole in the Middlebury firewall to allow off-campus connections.
You can find the manual page for the SSH command here or by typing "man ssh" on a Mac or Linux terminal. From the manual, the SSH command looks complicated; it's not! There are many optional arguments supported, but to get basic functionality all you need to supply to the command is the username you want to connect with and which machine you want to connect to. If the connection can be established, you will be prompted for the password of the account you are trying to connect with. If the connection cannot be established, you will be given some form of a "cannot resolve hostname" or "connection timed out" error (usually this means the machine is either disconnected from the network, or powered off).
NOTE: The examples below are all in UNIX format. To use SSH from a Windows machine, see the #PuTTY section.
The first time you remotely connect to a machine, you will be given a warning that the authenticity of the machine you are trying to connect to cannot be verified. Assuming you have correctly entered the name of a Middlebury managed machine or a Middlebury IP address, you can safely ignore this and enter "yes". In the grand scheme of things, if it's your first time connecting to a machine and you are expecting to get this response, you can usually ignore it and enter "yes". But, for the sake of completeness, you should be aware that spoofing is a thing.
$ [user@my-machine ~]: ssh <username>@machine-name
$ [user@my-machine ~]: ssh <username>@ip-address
$ [user@my-machine ~]: ssh <username>@killington.cs.middlebury.edu
$ [user@my-machine ~]: ssh <username>@188.8.131.52
Tip: If you are off-campus and need to connect to a specific machine, you can tunnel through basin to the machine you need with two ssh commands.
$ [user@my-machine ~]: ssh <username>@basin.cs.middlebury.edu
$ [username@basin ~]: ssh <username>@killington.cs.middlebury.edu
$ [user@my-machine ~]: ssh -t <username>@basin.cs.middlebury.edu ssh <username>@killington.cs.middlebury.edu
Secure CoPy is a command that combines the ssh command with the cp (copy) command. SCP can be used to push local files to a remote server, or it can be used to get a file from a remote server and save it locally.
You can find the manual page here or by typing "man scp" in a terminal window.
NOTE: This command only works for UNIX environments. For Windows, see the pscp utility provided by PuTTY
$ [user@my-machine ~]: scp path/to/file/to/send <username>@remote-location:path/to/location/to/put/file
$ [user@my-machine ~]: scp <username>@remote-location:path/to/file/to/get path/to/location/to/put/file/locally
$ [user@my-machine ~]: scp ./Documents/my_homepage.html email@example.com:~/public_html/homepage/
$ [user@my-machine ~]: scp firstname.lastname@example.org:~/cs101/homework1.py ~/Documents/this_semester/cs101/
Tip: You can select multiple source files in one scp command. SCP will evaluate as many files as you select until it reads a destination location (i.e. if you provide many local files, it knows to continue reading local files as sources, and when it reads a remote location, that is the destination, and vice versa). You can also supply the -r argument to recursively push entire directories.
Tmux is a Terminal MUltipleXer. It allows for multiple consoles within a single window, as well as the ability to detach and reattach processes from a single session. You can find the manual page here or by typing "man tmux" in a console.
NOTE: Tmux is a UNIX-only command. While untested by this author, the popular Windows-equivalent is ConEmu (short for Console Emulator). It allows for multiple Command Prompt or PuTTY sessions to be emulated alongside one another.
NOTE 2: If you are a Mac user and would like this utility installed on your machine, go here. It is installed on all CS Linux machines by default.
Keyboard shortcuts can be edited in the file ~/.tmux.conf. Here is a popular community cheat sheet.
Tmux commands come after what is referred to as a "command prefix". By default, "ctrl" + "b" is the command prefix. You can edit your prefix in #Keyboard_Shortcuts. In this tutorial, "ctrl" + "b" will be shortened to
CB, and commands will be written in the format
CB --> <key_to_press_after_prefix>.
You can achieve the most basic functionality of Tmux simply by calling it:
$ [user@my-machine ~]: tmux
Nothing will appear to happen, except the bottom of your console should change color. This means you are in a tmux session with one pane.
Let's split our single tmux pane horizontally. CB --> ". Now we have 2 consoles, one on top of the other. These consoles are independent of one another. You can use one to ssh to a remote server, and the other to search for local files on your machine, for example.
You can swap panes with CB --> o (or, you can allow tmux to read mouse input by inserting the line "set -g mouse on" into your .tmux.conf file). You can split panes as many times as you want (or until they become illegible!) with CB --> " for horizontal and CB --> % for vertical.
You can detach a tmux session from the current console with CB --> d (or by typing "tmux detach"). This means the process remains running, but as a distinct program separate from the current console window (useful, for example, if you are ssh'd into a server and want a process to continue running after you logout). You can reattach a tmux session with:
$ [user@my-machine ~]: tmux attach
If you intend to have multiple sessions of tmux running inside a single console session, you can name, attach, detach, and switch between them:
$ [user@my-machine ~]: tmux new -s session1
$ [user@my-machine ~]: tmux detach
$ [user@my-machine ~]: tmux new -s session2
$ [user@my-machine ~]: tmux detach
$ [user@my-machine ~]: tmux attach -t session1
$ [user@my-machine ~]: tmux switch -t session2
If you don't remember all of the sessions you have running, you can use the call:
$ [user@my-machine ~]: tmux list-sessions
to remind you what they are all called.
To kill the current pane, CB --> x. This will prompt at the bottom of your screen for a y/n to confirm.
There is so much more you can do with tmux, but this is just some basic functionality to get you up and running.
PuTTY is an open source SSH client developed for the Windows platform. You can download it here (just the putty.exe binary form will do, but if you are feeling ambitious you can download the .msi installer for all of the tools).
The PuTTY client has many options for customization (similar to optional arguments with the ssh command). But, to get the basic usage out of it, all you need to do is supply the full hostname of the machine you want to connect to.
If the connection can be made, you will be prompted with a window asking you the username that you would like to login with. After entering a username, you will be prompted for the password associated with the username. Upon successful authentication, you should see a terminal-esque window like what you would see in a Unix environment.
File System Resources
By enrolling in a Middlebury CS course, a CS user account is created for you. This account inherits your Middlebury username and password, but has resources that are distinct from your college account.
The account that is generated for you is a typical Unix user account. This means it has the standard folder structure you would expect on a Linux or Mac machine (i.e. Desktop, Documents, Pictures, etc).
You are the owner of your account and all files contained within your subdirectory. You are free to delete folders/files inside your user directory as you wish (now, remember, "Just because you can, doesn't mean you should" -- but if you really have an itch to delete everything, you can). You can create subfolders for classes or projects whenever you want. You can upload files to or download files from your user directory freely. It is YOUR account.
By default, your folder is viewable by anyone on the network (permission level rwxr-xr-x, or 755). This means people who are not you can view and execute (but NOT write to) files inside your user directory. If you would like to change this, talk to Ruben or research the
Miniconda is a stand-alone release of the popular package manager conda.
TODO: Examples of usage and reasons for virtual environments
nvm (for nodejs)