Intro

In the previous post, we looked at the installation and use requirements for the <STATS@UIUC> Big Data Image. Within this section, we cover some necessary shell commands, SSH, and how to use copy and paste.

Working within Shell

Linux, just like Windows, is powered by an underlying command line. In general, we usually will use a graphical user interface that allow us to point our mouse at a button, click the button, and have an action occur. Unfortunately, the image we are working with is the bare minimum and, thus, only allows us to submit commands via Shell.

Keyboard is king

Within shell, there is no mouse input recognized. Therefore, there are a few select keyboard shortcuts to know.

  1. Use SHIFT + Page Up or SHIFT + Page Down to scroll up or down on shell output that extends past what you can see.
  2. Use TAB to complete long file paths.
  3. Use CNTRL + Z to escaping out of a run away command. This will suspend the command from running.

Killing a process

After suspending a command, it is important to remove any resources that are allocated to it. This is similar to using CNTRL + ALT + DEL to bring up task manager to kill a command on windows.

For example, let’s say we had to suspend the vim command from running by using CNTRL + Z.

To kill the command, we must first find the Process ID (ID).

Type ps to receive a list of active processes organized by PID (Process ID), TTY (Terminal Issuing), TIME (CPU Usage), and CMD (Command Issued):

type ps and view results

We want to find the PID number associated with the vim CMD. From the output, the PID for the vim process is 5489.

To end the process, use kill -KILL PID, where PID is given above:

type kill -kill and proccess id

Note: The flag -KILL is in capitals as if you really wanted to kill someone.

Within the image, there is a text editor called vim that allows you to modify files from command line.

Here is a sample use of vim to modify a file.

  1. To open a file use: vim filename
  2. To insert new text or delete old test, enter into insert mode by typing i
  3. To move around in the editor use the arrow keys on your keyboard.
  4. Navigate to where you want to enter the text and then enter it!
  5. Press the Esc key
  6. Type :wq, : prepares vim for a command, w writes to the file, and q closes the file.

For a more structured exploration of vim, please see the interactive vim tutorial.

SSH

SSH allows you to remotely access contents of the a given computer. In this case, it may seem silly we are trying to remotely access an image that is running locally. However, by SSHing into the virtual image, we gain the ability to copy and paste.

Depending on your operating system, you may need additional software (e.g. Windows) to SSH into the image.

Windows SSH

For Windows, there exists an ssh client called PuTTY. Please download it! The way PuTTY is built does not require it to be installed to function.

  1. To use PuTTY double clicking the icon to open it.

PuTTY icon

  1. Enter in the Hostname field: 127.0.0.1 and in the Port field: 2222

PuTTY Setup

  1. Enter uiuc_hdp_image in the Saved Session field and press Save

PuTTY Save Session

  1. Press Open

PuTTY Open Session

  1. For the first time connecting, you will be asked to save a session key. Press Yes.

PuTTY Accept SSH Key

  1. Log in using - Username: rstudio and Password: rstudio

PuTTY Accept SSH Key

  1. To end the session, type logout. This will also close PuTTY.

PuTTY Accept SSH Key

  1. On subsequent PuTTY starts, just double click on the saved configuration

PuTTY Accept SSH Key

OS X and Linux SSH

For OS X and Linux, ssh is already built into terminal/shell.

  1. Open Terminal

  2. Type ssh rstudio@127.0.0.1 -p 2222

PuTTY Accept SSH Key

Copy and paste

In order to use copy and paste functionality, you will need to ssh into the image. Make sure that the image has been launched prior to trying to SSH in.

Copy from the session

  1. To make a selection of text to copy, drag the mouse pointer over it

  2. Click off the selected text

  3. Paste section into new window

Pasting into the session

  1. Copy text from file by highlight it and using either, Windows and Linux: CNTRL + C or Edit>Copy OS X: CMD+c
  2. Return to PuTTY / Terminal / Shell

  3. Right click to paste

  4. Press enter to run the command

Log out of the Virtual Box image

After you are done with the SSH session, please type logout to close the SSH session.

Also, please go through the appropriate shutdown procedure on the Virtual Box image. Otherwise, the image will still be active on your machines.

Misc

On the initial version of the image released, UIUC_IMAGE_VERSION='STAT490 Image Version: 1.0', rstudio was not authorized to SSH into the image. This has been fixed. Please see the resolved issue section at the end for the image patch.