Introduction to UNIX/Linux Exercises Dan Stanzione.

Slides:



Advertisements
Similar presentations
Linux commands exercise 1. What do you need, if you try to these at home? You need to download and install Ubuntu Linux from the Internet – DVD is need.
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
May 12, 2015 XSEDE New User Tutorials and User Support: Lessons Learned Marcela Madrid.
CIS 118 – Intro to UNIX Shells 1. 2 What is a shell? Bourne shell – Developed by Steve Bourne at AT&T Korn shell – Developed by David Korn at AT&T C-shell.
PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
CSCI 1411 FUNDAMENTALS OF COMPUTING LAB Lab Introduction 1 Shane Transue MSCS.
Introduction to Linux Alan Orth April 17, 2010 ILRI, Nairobi.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Introduction to Unix – CS 21 Lecture 13. Lecture Overview Finding files and programs which whereis find xargs Putting it all together for some complex.
Introduction to Unix – CS 21 Lecture 5. Lecture Overview Lab Review Useful commands that will illustrate today’s lecture Streams of input and output File.
Linux & Shell Scripting Small Group Lecture 4 How to Learn to Code Workshop group/ Erin.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
Introduction to Linux and Shell Scripting Jacob Chan.
ITCS 6/8010 CUDA Programming, UNC-Charlotte, B. Wilkinson, Jan 22, 2011assignprelim.1 Assignment Preliminaries ITCS 6010/8010 Spring 2011.
MCB Lecture #3 Sept 2/14 Intro to UNIX terminal.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
ISG We build general capability Introduction to Olympus Shawn T. Brown, PhD ISG MISSION 2.0 Lead Director of Public Health Applications Pittsburgh Supercomputing.
BIF703 stdin, stdout, stderr Redirection. stdin, stdout, stderr Recall the Unix philosophy “do one thing well”. Unix has over one thousand commands (utilities)
The “File System” Under UNIX, (almost) everything is a “file”: –Normal files –Directories –Hardware –Sockets –Pipes Things that are not files: –Users –Groups.
Advanced UNIX Shell Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
Bigben Pittsburgh Supercomputing Center J. Ray Scott
| nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Using Commands Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer,
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
Week 9 - Nov 7, Week 9 Agenda I/O redirection I/O redirection pipe pipe tee tee.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
| nectar.org.au NECTAR TRAINING Module 10 Beyond the Dashboard.
ISG We build general capability Introduction to Olympus Shawn T. Brown, PhD ISG MISSION 2.0 Lead Director of Public Health Applications Pittsburgh Supercomputing.
Unix Servers Used in This Class  Two Unix servers set up in CS department will be used for some programming projects  Machine name: eustis.eecs.ucf.edu.
1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
Learning Unix/Linux Based on slides from: Eric Bishop.
Introduction to Scripting Workshop February 23, 2016.
Intro to GNU/Linux See, Stallman? I said GNU. Are you happy now?
Assignprelim.1 Assignment Preliminaries © 2012 B. Wilkinson/Clayton Ferner. Modification date: Jan 16a, 2014.
An Brief Introduction Charlie Taylor Associate Director, Research Computing UF Research Computing.
Advanced Computing Facility Introduction
Hackinars in Bioinformatics
GRID COMPUTING.
ENEE150 Discussion 01 Section 0101 Adam Wang.
Tutorial of Unix Command & shell scriptS 5027
Development Environment
CS1010: Intro Workshop.
Unix Scripts and PBS on BioU
Development Environment Basics
Prepared by: Eng. Maryam Adel Abdel-Hady
Andy Wang Object Oriented Programming in C++ COP 3330
The Linux Operating System
Shell Script Assignment 1.
Assignment Preliminaries
Basic UNIX OLC Training.
College of Engineering
Guide To UNIX Using Linux Third Edition
Introduction Paul Flynn
Andy Wang Object Oriented Programming in C++ COP 3330
More advanced BASH usage
Yung-Hsiang Lu Purdue University
CSE 303 Concepts and Tools for Software Development
Presentation transcript:

Introduction to UNIX/Linux Exercises Dan Stanzione

Logging In To access remote systems, you need a Secure Shell (ssh) client for your system – Linux and Mac systems have these already – For Windows users, need to download a client: For this lab, I recommend “putty”, a free client (Google “putty” - fast, free, easy) – Download and install a client now

Logging In Once you have a client, you are ready to connect. – For this first lab, login to “ranger.tacc.utexas.edu”, a Sun/Linux supercomputer at TACC Use your assigned training ID If you don’t have an ID, tell me now. – Try logging in now… For MAC/Linux users, from the terminal type: “ssh where XXX is your assigned Windows users, click “connect” and follow the directions

Basic File Manipulations Exercises: – List your current files – List your files, showing their size, and all hidden files – Determine your current working directory

Basic File Manipulations Exercises: – Make two new files by typing the following commands: Login3$ touch foo login3$ echo “This is my data” > bar – Check the size and modified date of your new files. – Delete the file “foo” – Now, let’s create a new file “foo” with your favorite text editor… Add the contents, “This is also my data”

Pipes and Redirects The power of UNIX is the ability to chain commands together to do powerful things. –login3$ cat foo bar >foobar –login3$ echo “More Data” >> foobar What’s in the file “foobar”? Find instances of the word “data” –Login3$ grep data foobar What’s missing? Why? What if I want to know *how many* times the word data appears in the file? –login3$ grep data foobar | wc -l Grep can be used with Word Count to do complex functions with simple tools.

Simple Scripting What about “Data”? –login3$ grep -i data foobar OK, now let’s get wild… find instances of the word “data”, case insensitive, in every file in the directory: –login3$ for i in `ls`; do grep -i data $i; done – One pretty fancy line, lots to type. – Try this… type the “for I in `ls`” part, then press enter(return). ! login3$ for i in `ls` Input > do Input > grep -i data $i Input > done So, now you’re putting a whole list of commands together… would be handy to be able to save these and use them again and again… this is called scripting.

Simple Scripting Use your text editing skills to put all these commands in a file. Call it “datafinder” #!/bin/bash for i in `ls` do grep -i data $i done Now, let’s run it… first make it executable: ! general > chmod +x datafinder Now run it… ! general >./datafinder Now, use it in a pipe to count how many times “data” is in all your files. ! general >./datafinder | wc -l

Simple Scripting This ability to combine commands, through scripts and pipes, let’s you take elegant, simple tools, and build arbitrarily complex structures for manipulating files and data. No amount of windows clicks can match it (and in fact, windows has scripts too). Of course, many of the simple ones are done for you… datafinder could be replaced by a wildcard : –login3$ grep -i data * | wc -l But often, you want something more complex… Try modifying your datafinder script to print the name of the file before printing the output of “grep” on it.

Want to try running a job on a supercomputer? To this point, you’ve been using the Ranger login node as a simple UNIX computer. To really take advantage of it, you need to put a job on a compute node… this requires using the batch queue. To do this, you will need to write a job script (like any other script).

Sample Job Script #!/bin/bash #$ -N myMPI # Job Name #$ -j y # Combine stderr and stdout #$ -o $JOB_NAME.o$JOB_ID # Name of the output file #$ -pe 12way 24 # Requests 12 tasks/node, 24 cores total #$ -q normal # Queue name "normal" #$ -l h_rt=01:30:00 # Run time (hh:mm:ss) hours # Put the commands you want to run here./datafinder

Running this script To execute this job script: – Save it in a file named something like “jobscript.sh” – (or copy sample_job_script.sh from ~dstanzi/) cp ~dstanzi/sample_job_script.sh./jobscript.sh –login3$ qsub jobscript This will run the job.

Then what? Check your job status: – “showq” – (this is a good time to use those “grep” skills. Note your job has a number! – Find your output file in a file named: Jobname.jobnumber – Each time you run it, you will get a unique output file. – You may have to wait a while if the machine is busy (Ranger only has 62,976 processors).

Notes In a real job script, you would add a line to bill to your project, especially if you have more than one (not needed today). – #$ -A IPLANT You don’t really need 24 processors to run “datafinder” – In a real large scale job, you will use the MPI launcher; instead of the “./datafinder” line use: ibrun./my_program

How do I learn More? The User Guide – user-guide user-guide Training Classes – Check full listings at: Online Training – Advanced User Support

How do I get help? The User Portals – phere phere – – For most routine requests, use the portal to submit a ticket; you will be contacted quickly (tickets monitored 24x7). Password help, general inquiries, software installs, requests for consulting, allocation questions etc.