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.
Page Downto scroll up or down on shell output that extends past what you can see.
TABto complete long file paths.
Zto 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
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
To kill the command, we must first find the Process ID (ID).
ps to receive a list of active processes organized by PID (Process ID), TTY (Terminal Issuing), TIME (CPU Usage), and CMD (Command Issued):
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:
Note: The flag
-KILL is in capitals as if you really wanted to kill someone.
Navigating the text editor
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.
- To open a file use:
- To insert new text or delete old test, enter into insert mode by typing
- To move around in the editor use the arrow keys on your keyboard.
- Navigate to where you want to enter the text and then enter it!
- Press the
:prepares vim for a command,
wwrites to the file, and
qcloses the file.
For a more structured exploration of
vim, please see the interactive vim tutorial.
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.
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.
- To use PuTTY double clicking the icon to open it.
- Enter in the
127.0.0.1and in the
Saved Sessionfield and press
- For the first time connecting, you will be asked to save a session key. Press
- Log in using - Username:
- To end the session, type
logout. This will also close PuTTY.
- On subsequent PuTTY starts, just double click on the saved configuration
OS X and Linux SSH
For OS X and Linux, ssh is already built into terminal/shell.
ssh email@example.com -p 2222
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
To make a selection of text to copy, drag the mouse pointer over it
Click off the selected text
Paste section into new window
Pasting into the session
Copy text from file by highlight it and using either, Windows and Linux:
Return to PuTTY / Terminal / Shell
Right click to paste
- 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.
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.