Session 1: Accessing MUGrid and Command Line Basics

Similar documents
CS CS Tutorial 2 2 Winter 2018

User Guide Version 2.0

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Introduction to the Linux Command Line

LAB #5 Intro to Linux and Python on ENGR

Parallel Programming Pre-Assignment. Setting up the Software Environment

Introduction of Linux

Bitnami Apache Solr for Huawei Enterprise Cloud

Commands are in black

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands

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

CSCI 2132 Software Development. Lecture 4: Files and Directories

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Bitnami MEAN for Huawei Enterprise Cloud

Introduction: What is Unix?

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

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to Linux

AMS 200: Working on Linux/Unix Machines

LAB #7 Linux Tutorial

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

Introduction to Linux

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Short Read Sequencing Analysis Workshop

Unix Tutorial Haverford Astronomy 2014/2015

A Hands-On Tutorial: RNA Sequencing Using High-Performance Computing

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Lab Working with Linux Command Line

Lab 1 Introduction to UNIX and C

Perl and R Scripting for Biologists

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating System Interaction via bash

Unix Introduction to UNIX

Computer Systems and Architecture

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Introduction to Linux for BlueBEAR. January

Datathon 2018 Connecting to MicroStrategy on AWS Cloud

CS Fundamentals of Programming II Fall Very Basic UNIX

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

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

Introduction to Linux and Supercomputers

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

Overview of the UNIX File System

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

CSE115 Lab exercises for week 1 of recitations Spring 2011

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Unix Workshop Aug 2014

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

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

Introduction to Linux

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Lab 1 Introduction to UNIX and C

Introduction to Unix - Lab Exercise 0

COSC UNIX. Textbook. Grading Scheme

Linux File System and Basic Commands

Unit 10. Linux Operating System

Helsinki 19 Jan Practical course in genome bioinformatics DAY 0

New User Tutorial. OSU High Performance Computing Center

Introduction to Algorithms and Programming I Lab. Exercises #1 Solution

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Linux Exercise. pwd answer: We call this directory (into which you get when you log in) your home directory.

Introduction to Linux. Fundamentals of Computer Science

Bitnami JRuby for Huawei Enterprise Cloud

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Introduction to Linux

Linux Shell Script. J. K. Mandal

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

Linux/Cygwin Practice Computer Architecture

CHEM5302 Fall 2015: Introduction to Maestro and the command line

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

Tutorial 1: Unix Basics

Unit 13. Linux Operating System Debugging Programs

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

CISC 220 fall 2011, set 1: Linux basics

Introduction to Linux Workshop 1

Getting started with Hugs on Linux

Introduction. SSH Secure Shell Client 1

STA 303 / 1002 Using SAS on CQUEST

Linux Bootcamp Fall 2015

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

Introduction to Linux

The Command Shell. Fundamentals of Computer Science

Getting Started with UNIX

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

Part I. Introduction to Linux

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

INTRODUCTION TO BIOINFORMATICS

Introduction to Linux Basics

mkdir Phys338 s2017 Draw the tree of the directories and files for this step and all the following cd Phys338 s2017

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

Mills HPC Tutorial Series. Linux Basics I

Computer Systems and Architecture

Linux Systems Administration Getting Started with Linux

Introduction to Linux and Cluster Computing Environments for Bioinformatics

Transcription:

Session 1: Accessing MUGrid and Command Line Basics Craig A. Struble, Ph.D. July 14, 2010 1 Introduction The Marquette University Grid (MUGrid) is a collection of dedicated and opportunistic resources spread around Marquette s campus. The primary resources is pere.marquette.edu, which is a 128 node/1024 core compute cluster funded by the NSF. In addition to the cluster, lab machines in the Department of Mathematics, Statistics, and Computer Science, the College of Engineering, and the Raynor Memorial Libraries contribute idle machine cycles for research computing. Approximately 500 cores are available from idle machines. Figure 1 illustrates the resources available across campus. Currently, most of these resources run versions of Linux, primarily derived from Red Hat Enterprise Linux. The purpose of this session is to provide instructions on how to access MUGrid systems and use the Linux command line, which is the most common interface to research computing systems worldwide. The skills used to access MUGrid systems are similar to those needed for national grid resources available on TeraGrid and Open Science Grid, to practice on MUGrid will transfer to other resources. One other note, although Linux is used throughout, the same commands apply to other Unix-like systems such as Solaris, FreeBSD/NetBSD/OpenBSD (with some minor differences), and the Mac OS X command line. 2 Local vs. Remote Systems Your local system is the computer you are sitting at. Files and programs are (typically) stored on the hard drive in the machine in front of you. You use the local system s memory, CPU, and peripherals (e.g. keyboard) to get work done. A remote system is a computer you access through a network or other communications channel. Files and programs are (typically) stored on the remote system and not on the local system you type on. Furthermore, when applications are run on the remote system, the applications use that system s memory, CPU and peripherals, not the local system s. Figure 2 illustrates the difference between local and remote systems. For the remainder of this session, you will be using a lab computer, your desktop computer, or your own laptop as the local system. You will access and use the MUGrid cluster named pere.marquette.edu as the remote system. 3 Accessing pere.marquette.edu Access to pere.marquette.edu is limited to Marquette University networks. Off campus access is available through Marquette s VPN and special arrangement with specific labs. To access pere.marquette.edu users must use a secure shell (SSH) client appropriate for their system. An SSH client provides an encrypted communication channel to access a remote system like pere.marquette.edu. The client provides a basic command line interface (CLI), where you type in textual commands to launch applications and get work done. While there is a significant learning curve to CLIs, a CLI provides flexibility and efficiency in the long term that graphical user interfaces (GUIs) have not 1

Figure 1: The MUGrid resources. Local Remote Figure 2: Local vs. Remote Systems 2

yet provided. A CLI is the primary means to accessing MUGrid resources as well as national resources on TeraGrid and Open Science Grid. 3.1 Accessing from Windows On Windows, the free Putty client available at http://www.chiark.greenend.org.uk/~sgtatham/putty/ is easy to install and use. Just download the latest binary from http://the.earth.li/~sgtatham/putty/ latest/x86/putty.exe and place it on your desktop. The Putty window is shown in Figure 3. Fill in the Host Name as pere.marquette.edu. Once connected, you ll be asked for your user name and password. Provide your assigned Marquette ID and password. Figure 3: Putty window after launching. A commercial option is the official SSH client, which is installed on several Marquette systems. The initial window is show in Figure 4. To login, click the Quick Connect button and fill in Host Name: as pere.marquette.edu and User Name: as your user name. The login window is shown in Figure 5. 3.2 Accessing from Linux and Mac OS X Linux and Mac OS X systems include SSH clients. On Mac OS X, first start a terminal session by double clicking on the Terminal application in the /Applications/Utilities folder. This will bring up a window similar to one shown in Figure 6. 3

Figure 4: Initial SSH window. On Linux, several console and terminal applications exist. Refer to your specific distribution documentation to find one. Once a terminal session has been opened, type in the command $ ssh username@pere.marquette.edu where username is your assigned user ID. When prompted for your password, type in your assigned password. You should then be presented with a prompt awaiting commands to run on pere.marquette.edu instead of your local machine. Exercises 1. Using your assigned username and password, access pere.marquette.edu. When presented with a prompt, type in the command $ echo Hello World You should see the text Hello World on the screen and presented with another prompt. 4

Figure 5: SSH login dialog box. 4 Directories In Linux, files are organized in a hierarchical directory (aka folder) structure with a single root denoted /. A sample of the Linux directory structure on pere.marquette.edu is shown below. / home bin etc lib sbin usr MARQNET bin include lib local sbin bobc bin A path is a sequence of directories separated by path separators, which on Linux is the slash (/) character. The path from the root to the bobc directory in the previous figure is /home/marqnet/bobc. Paths can be either absolute, which means they start with the root directory (/) or relative, which means they do not start with the root directory. For example, the relative path to bobc that is relative to /home is MARQNET/bobc. Relative paths are important when combined with the concept of working directories. 5

Figure 6: Mac OS X terminal window. 4.1 Working Directory The most important concept for navigating Linux systems like pere.marquette.edu is the working directory. The working directory is your current position in the directory structure and plays important roles when executing commands or editing files. Your working directory is where files will be found by commands unless you specify otherwise. Display Working Directory To display your current working directory, use the command $ pwd which stands for print working directory. Relative paths always start from your working directory. referring to files and directories using relative paths. It is important to keep this in mind when 4.2 Home Directories Every user has a home directory, which is the initial working directory when you log into a Linux system. Your home directory is where you store your documents, data, programs, etc. You can organize your files any way you wish within your home directory and can control who has access to those files using Linux file permissions. 6

Finding Your Way Home The primary purpose for introducing home directories now is that you can always find your way home by typing the command $ cd which stands for change directory. Without anything else on the command line, cd returns you to your home directory. 4.3 Navigating Directories Navigating directories on a Linux system means to change your working directory. establish a new context for the commands you execute. To change into a directory, use By navigating, you $ cd dirname where dirname is the directory you want to make your new working directory. To back up one directory in the hierarchy, use $ cd.. 4.4 Creating Directories As you generate more files and need to organize them, you will want to create new directories. Use $ mkdir dirname where dirname is the name of the directory you want to create. 4.5 Listing Directory Contents To view the contents of your working directory, type $ ls You will be presented with a list of file and directory names that are stored in your working directory. To list the contents of a specific directory, type $ ls dirname where dirname is the name of the directory you want to view. A similar list of file and directory names in dirname will be presented. 7

Exercises 1. Using the commands above, create the following directory hierarchy rooted at your home directory, which is denoted $HOME. $HOME bin Documents Projects First Second If done correctly, a recursive listing using the command $ ls -R in your home directory produces the output.: bin Documents./bin:./Documents: Projects./Documents/Projects: First Second./Documents/Projects/First:./Documents/Projects/Second: Write down the command(s) you use to create this directory structure. 2. Navigate so that $HOME/Documents/Projects/First is your working directory. Write down the command(s) you use to do so. 3. If $HOME/Documents/Projects/First is your working directory, use a relative path and the cd command to make $HOME/Documents/Projects/Second your working directory. Write down the command you use. 4. If $HOME/Documents/Projects/Second is your working directory, use ls and a relative path to list the directory $HOME/bin. 5. What are the contents of /group/hpc-bootcamp/summer2010/session1 on pere.marquette.edu? 8

5 Editing and Viewing Files One of the most common tasks performed on remote systems like pere.marquette.edu is to create and edit text files. Scripts, programs, notes, etc. all typically reside in text files that may have special formatting rules. 5.1 Editing Files A simple to use editor available on pere.marquette.edu and most Linux systems is pico. The editor is started with $ pico From there, you can type in any text that you want. pico will automatically move text to a new line if the line length gets too long. Most of the time this is fine, but when writing scripts and programs later, this is a feature that can cause problems. You can also directly edit an existing file or create a new file with a specific name by adding a command line argument to pico $ pico filename where filename is the name of the file to create or edit. 5.2 Viewing Files Frequently, you want to view the contents of a file without editing it. files is A commonly used command to view $ more filename where filename is the name of the file to view. The more command lets you interactively scroll through the file contents one screenful at a time. Use the spacebar to scroll down, b to scroll back (up) and q to quit viewing the file. You can view the contents of a file all in one go with the command $ cat filename where filename is the name of the file to view. The file contents will scroll quickly in your terminal window. This is useful if you prefer using the scrollbar in your terminal program to navigate the file contents. Exercises 1. Assuming you have created the directory structure earlier, create a file named README.txt in $HOME/Documents/Projects/First. Type in your name, the current date, and a brief description of your first MUGrid project. Creating README.txt files is good practice so that you can remember what a project is about 6 months after you last worked on it. 2. View the contents of your README.txt using more and cat commands. 3. View the file in /group/hpc-bootcamp/2010summer/session1/shakespeare.txt using the more and cat commands. 9

6 Transferring Files To transfer files between your local system and pere.marquette.edu, a secure copy (SCP) or secure file transfer (SFTP) client is needed. On Windows, WinSCP is a good, free option. SSH also provides a file transfer client in their commercial option. These clients provide graphical, fairly easy to use means to drag files between local and remote systems. The hostname to provide is pere.marquette.edu and username and password are the same as those used when accessing pere.marquette.edu to begin with. On Linux and OS X, the best approach to transfer files is the scp command. This is similar to the regular copy cp command. Remote files are denoted using a hostname followed by a colon (:). For example, to copy a file to pere.marquette.edu, use the command $ scp localfile username@pere.marquette.edu:remotefile To copy a file from pere.marquette.edu, to the local system reverse the order of arguments. $ scp username@pere.marquette.edu:remotefile localfile remotefile is assumed to be in your home directory on pere.marquette.edu, but you can provide both relative and absolute paths to reference other files. You can also recursively copy a directory with the -r option. The command $ scp -r username@pere.marquette.edu:documents/projects/first First recursively copies the contents of First on pere.marquette.edu to a local directory First in the local working directory. Exercises 1. Create a README.txt file using a text editor on your local machine. If you re using Windows, Notepad is a program for creating simple text files. Transfer this file using the SFTP/SCP client available on your system to the remote directory $HOME/Documents/Projects/Second. 2. View the contents of the README.txt file using more or cat on the remote system pere.marquette.edu. 3. Transfer the file /group/hpc-bootcamp/2010summer/session1/shakespeare.txt from the remote system pere.marquette.edu to your local system. Use a local text editor or viewing program (e.g. Notepad) to read the file. 7 Other Useful Commands Copying, Renaming, and Moving Files Copy a file $ cp origfile newfile Rename a file 10

$ mv origname newname Move a bunch of files into a directory $ mv file1 file2... dirname Note that dirname must already exist to move files into the directory. Removing Files and Directories Remove a bunch of files. Beware there s no going back. $ rm file1 file2... Remove an empty directory. $ rmdir dirname Recursively remove a directory and its contents. Beware, this is powerful and dangerous. $ rm -r dirname Useful Information Read the online manual page for a command. $ man command See what processes you are running. $ ps See the processes you and others are running. $ ps -efww 11