LAB #5 Intro to Linux and Python on ENGR

Similar documents
Once you have installed MobaXterm, open MobaXterm. Go to Sessions -> New Session, and click on the SSH icon.

CS CS Tutorial 2 2 Winter 2018

Lab 1 Introduction to UNIX and C

Session 1: Accessing MUGrid and Command Line Basics

User Guide Version 2.0

Temple University Computer Science Programming Under the Linux Operating System January 2017

Part I. UNIX Workshop Series: Quick-Start

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Introduction to the Linux Command Line

Intermediate Programming, Spring Misha Kazhdan

15-122: Principles of Imperative Computation

CS 246 Winter Tutorial 1

Lab 1 Introduction to UNIX and C

Linux at the Command Line Don Johnson of BU IS&T

Short Read Sequencing Analysis Workshop

For Dr Landau s PHYS8602 course

ECE112 - Lab 6. Purpose. Parts/tools needed: Make sure we have a properly working environment

CS 1301 Fall 2008 Lab 2 Introduction to UNIX

sftp - secure file transfer program - how to transfer files to and from nrs-labs

Getting Started with UNIX

CS 143A. Principles of Operating Systems. Instructor : Prof. Anton Burtsev

Software Installation - Accessing Linux and Checking your Environmental Variables

CMSC 201 Spring 2017 Lab 01 Hello World

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

CMSC 201 Spring 2018 Lab 01 Hello World

The Command Shell. Fundamentals of Computer Science

Bitnami Apache Solr for Huawei Enterprise Cloud

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

CSE 391 Editing and Moving Files

Unix. Examples: OS X and Ubuntu

Introduction: What is Unix?

Lab 1: Introduction to C, ASCII ART & the Linux Command Line

Unix Shells and Other Basic Concepts

Getting Started With UNIX Lab Exercises

Raspberry Pi Setup Tutorial

One of the hardest things you have to do is to keep track of three kinds of commands when writing and running computer programs. Those commands are:

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

Mills HPC Tutorial Series. Linux Basics I

Linux hep.wisc.edu

New User Tutorial. OSU High Performance Computing Center

Quick Guide to Installing and Setting Up MySQL Workbench

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2

CS 261 Recitation 1 Compiling C on UNIX

Introduction to Linux for BlueBEAR. January

CS Operating Systems, Fall 2018 Project #0 Description

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011)

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

Linux Command Line Interface. December 27, 2017

CSE 391 Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors

C++ Programming on Linux

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Using IDLE for

Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi

Linux/Cygwin Practice Computer Architecture

Operating System Interaction via bash

Helsinki 19 Jan Practical course in genome bioinformatics DAY 0

Introduction to Unix - Lab Exercise 0

Bitnami MEAN for Huawei Enterprise Cloud

Intro. To Unix commands. What are the machines? Very basics

COSC UNIX. Textbook. Grading Scheme

CSE 390a Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors

Datathon 2018 Connecting to MicroStrategy on AWS Cloud

Ftp Command Line Commands Linux Example Windows Put

CSC116: Introduction to Computing - Java

Introduction to Linux. Fundamentals of Computer Science

CSC111 Computer Science II

Lab 1: Getting Started with Linux The Extremely Illustrated Version. Graham Northup

Introduction to Linux Environment. Yun-Wen Chen

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

STA 303 / 1002 Using SAS on CQUEST

No Food or Drink in this room. Logon to Windows machine

Remote Access to Unix Machines

Eugene, Niko, Matt, and Oliver

Introduction to Unix and Linux. Workshop 1: Directories and Files

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Working With Unix. Scott A. Handley* September 15, *Adapted from UNIX introduction material created by Dr. Julian Catchen

Lab #2 Physics 91SI Spring 2013

CMPSCI 120 Fall 2017 Lab #1 Professor William T. Verts

CHE3935. Lecture 1. Introduction to Linux

Tutorial 1: Unix Basics

Parallel Programming Pre-Assignment. Setting up the Software Environment

Virtual Desktop Infrastructure Setup for MacOS

Virtual Desktop Infrastructure Setup for MacOS

CS Fundamentals of Programming II Fall Very Basic UNIX

Galaxy How To Remote Desktop Connection and SSH

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

CMPSCI 120 Fall 2013 Lab #2 Professor William T. Verts

Outline. Structure of a UNIX command

1 Getting Started with Linux.

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

CS/CIS 249 SP18 - Intro to Information Security

commands exercises Linux System Administration and IP Services AfNOG 2015 Linux Commands # Notes

HPC Introductory Course - Exercises

Using the Zoo Workstations

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Using WestGrid from the desktop Oct on Access Grid

Transcription:

LAB #5 Intro to Linux and Python on ENGR 1. Pre-Lab: In this lab, we are going to download some useful tools needed throughout your CS career. First, you need to download a secure shell (ssh) client for connecting to remote machines, which are machines located away from the local machine in front of you. In addition, you need to download a secure copy (scp) or secure file transfer (sftp) client to transfer files between your local machine and remote machines, such as the ENGR server. Download a free Secure Shell (ssh) from OSU (preferably PuTTY for Windows):** http://oregonstate.edu/helpdocs/software/recommended-software/osuware **NOTE: If you are using a Mac or Linux laptop, then you already have a terminal w/ ssh/scp built into the OS. Download a free GUI Secure File Transfer (sftp) from OSU (preferably Cyberduck for MacOS and WinSCP for Windows): http://oregonstate.edu/helpdocs/software/recommended-software/osuware Lastly, you want to map a network drive to the ENGR server. This allows you to directly work off the server as if it were a disk drive on your computer. You can follow these instructions to map a network drive for Windows or MacOS. http://engineering.oregonstate.edu/computing/fileaccess/windows_file_sharing/#map _network_drive If you want to use the drive off campus, then you must download the Cisco VPN Client from OSU: http://oregonstate.edu/helpdocs/network/vpn-campus-access **NOTE: You may want to put these programs on a flash drive to carry with you in your backpack. This will help you get around from any computer without needing your laptop all the time. 2. Once you download putty, the file is an.exe that can be opened without being installed. **NOTE: If you are using a Mac or Linux laptop, then you have a terminal w/ ssh built into the OS. Open the terminal, and type ssh username@access.engr.oregonstate.edu at the prompt.

3. Open the ssh client and type the following address in the hostname: access.engr.oregonstate.edu I suggest you load the engr host name under a saved session by typing something in the Saved Sessions text area and pressing the Load button. This makes it easier to save specific properties to the session such as font, background color, text color, etc. Then, you can simply select the saved session each time before pressing Open. Two properties you may want to change immediately in the ENGR session is The Backspace key located under the Terminal -> Keyboard tab. This will eliminate those annoying ^? when pressing the backspace key in the vim text editor. You can also eliminate the Access denied message that pops in Putty up after entering your user name when logging into the system by removing the check mark in the Attempt GSSAPI authentication box under the Connection -> SSH -> Auth -> GSSAPI tab (See first image on next page).

Another property you might want to check is the terminal type you are using. Go to the Connection -> Data tab, and type xterm in the Terminal-type string text area (See second image on next page). This terminal type ensures that color coding is used for your programs in the vim text editor. Don t worry if you don t understand what this means right now, you will later Make sure you go back to the Session tab and press the Save button before opening the ENGR session. This will save these properties and ensure that you do not have to do ALL this again 4. Now, open the ENGR session you just created, and enter your username and password at the prompt. **Note: You will not see anything as you type your password. This is a security feature in Linux!!! After a successful logon, you should get a prompt like the one below: flip1 ~ % If you do not have an ENGR username and password, then your TA will help you apply for one.

5. At the prompt, use the following commands to look at your files and directories in your home directory. Note the differences to your lab instructor. % ls % ls -a % ls -l % ls al **Note: You should notice a. and.. directory listed. The. directory refers to your current directory, and the.. directory refers to one directory above your current directory. The ~ refers to your home directory. 6. UNIX/Linux provides you manual pages for the commands. You are encouraged to read these manual pages when you have questions about a specific command or want more details about the options to use with a command. Use the space bar to scroll forward through the manual pages (one page at a time), press b to scroll backwards (one page at a time), and press q to quit the manual page. You can also use the up and down arrow keys to scroll forward and backward one line at a time, but who wants to do this % man ls 7. In addition, if you are not sure what a command is in UNIX/Linux, then you can find the appropriate command using apropos and a keyword. For example, what are the UNIX/Linux commands for editing a file, working with a directory, etc. % apropos editor % apropos directory 8. You may have noticed that you get more text than what can fit in your terminal window. To view data a page at a time in your terminal, you can pipe the command contents through another command called less. This will allow you to scroll through the pages using space bar, b, and q just as you did with the manual pages. % apropos directory less

9. Make a class directory in your home directory containing another directory named labs, and change into the labs directory. % mkdir cs160 % cd cs160 % mkdir labs % cd labs 10. Create a directory in your labs directory named lab1, and change into the lab1 directory. % mkdir lab1 % cd lab1 11. Make a note of your present working directory. % pwd 12. You can go back/up a directory by using two periods/dots together, and you can go back to your home directory by using the tilde, ~. Use the pwd to confirm you are back in your home directory. % cd.. % cd ~ % pwd 13. The files preceded by a period/dot are system files, which are hidden with a normal directory listing using ls. Currently, your path does not include the location of python3, which is located at /usr/local/apps/python/current/bin. You can view the PATH environment variable by using the following command: % echo $path In order to change the value of this variable, we need to modify the.cshrc system file. We are going to use the pico text editor to look for the path variable and add the python3 path to the file. % pico ~/.cshrc We will search for the path pattern by pressing Ctrl-W, then type path. You go to the next path found by pressing Ctrl-W and Enter, until you find the line that has: set path = ($path ~/bin.)

First, remove your current directory from your path, which is a security issue, and add this path /usr/local/apps/python/current/bin to the end of this line: set path = ($path ~/bin /usr/local/apps/python/current/bin) Write and quit by typing Ctrl-X, Y, and Enter. Now, you will need to source the.cshrc to activate the changes. % source ~/.cshrc 14. Now, change into the cs160/labs/lab1directory by using your up arrow key to take you through the history of commands you ve used in the past. You should see the cd cs160, cd labs, and cd lab1 command you typed earlier. You can also change directly into the lab1 directory by using cd cs160/labs/lab1. 15. A good rule of thumb is to use pwd at any time to determine where you are, in case you forget Also, don t be scared to use ls as often as you need to see a listing of your current directory! 16. First, let s use a text editor in Linux to help us create a Python program on the ENGR server. Make a program that prints out a pretty picture using ascii art, such as the triangle we drew in class.

% pico ascii_art.py 17. After you finishing writing your program, save and quit by typing Ctrl-X, Y, and Enter. Now, run your python code using the Python 3 interpreter. % python3 ascii_art.py 18. Now, we want to make sure you know how to get files from the engr server to your local machine and to the TEACH website. First, upload your ascii_art.py file to TEACH using a mapped network drive connection. Now, transfer the file to your local computer using a scp/sftp client, and then upload it to TEACH from your local computer. 19. In order to receive credit for your lab, show your Python code to a lab TA before leaving the lab, otherwise you ll receive zero points!!!