Linux Tutorial. Ken-ichi Nomura. 3 rd Magics Materials Software Workshop. Gaithersburg Marriott Washingtonian Center November 11-13, 2018

Similar documents
Introduction to Linux Workshop 1

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

Mills HPC Tutorial Series. Linux Basics I

AMS 200: Working on Linux/Unix Machines

Introduction to Linux Environment. Yun-Wen Chen

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

Introduction to Linux for BlueBEAR. January

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

Introduction: What is Unix?

Introduction to Linux. Fundamentals of Computer Science

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

For Dr Landau s PHYS8602 course

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Practical Session 0 Introduction to Linux

Linux/Cygwin Practice Computer Architecture

The Unix Shell & Shell Scripts

Introduction to GACRC Teaching Cluster

Linux Command Line Primer. By: Scott Marshall

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

Short Read Sequencing Analysis Workshop

Computer Systems and Architecture

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

An Introduction to Unix

Basic Linux Command Line Interface Guide

Scripting Languages Course 1. Diana Trandabăț

Intermediate Programming, Spring Misha Kazhdan

Chapter-3. Introduction to Unix: Fundamental Commands

Basic Linux Command Line Interface Guide

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based.

Unix Tutorial Haverford Astronomy 2014/2015

Introduction of Linux

Linux Bootcamp Fall 2015

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

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

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

Working with Basic Linux. Daniel Balagué

5/8/2012. Creating and Changing Directories Chapter 7

Linux environment. Graphical interface X-window + window manager. Text interface terminal + shell

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

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

Part I. UNIX Workshop Series: Quick-Start

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

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

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

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

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017

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

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

An Introduction to Gauss. Paul D. Baines University of California, Davis November 20 th 2012

Perl and R Scripting for Biologists

Laboratory 1 Semester 1 11/12

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

A Brief Introduction to Unix

HPC Introductory Course - Exercises

Intro to HPC Exercise

Using the Unix system. UNIX Introduction

Unix Workshop Aug 2014

Introduction to Linux

Computer Systems and Architecture

Introduction to Linux Basics

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

Introduction to the Linux Command Line

Introduction to Linux

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

Introduction to Linux Spring 2014, Section 02, Lecture 3 Jason Tang

Beginner's Guide for UK IBM systems

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Linux Shell Script. J. K. Mandal

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

Session 1: Accessing MUGrid and Command Line Basics

Introduction to GACRC Teaching Cluster PHYS8602

CS 261 Recitation 1 Compiling C on UNIX

Exercise 1: Basic Tools

Getting Started With UNIX Lab Exercises

Basic UNIX Commands BASIC UNIX COMMANDS. 1. cat command. This command is used to create a file in unix. Syntax: $ cat filename

Introduction to the basics of UNIX

Arkansas High Performance Computing Center at the University of Arkansas

Linux Systems Administration Getting Started with Linux

Introduction to Unix: Fundamental Commands

Bioinformatics? Reads, assembly, annotation, comparative genomics and a bit of phylogeny.

Systems Programming and Computer Architecture ( ) Exercise Session 01 Data Lab

Unix basics exercise MBV-INFX410

COSC UNIX. Textbook. Grading Scheme

Introduction to GACRC Teaching Cluster

Introduction to the UNIX command line

CENG 334 Computer Networks. Laboratory I Linux Tutorial

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Introduction to Linux

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

Chap2: Operating-System Structures

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

Introduction to Linux

Std: XI CHAPTER-3 LINUX

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

Using a Linux System 6

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

Transcription:

Linux Tutorial Ken-ichi Nomura 3 rd Magics Materials Software Workshop Gaithersburg Marriott Washingtonian Center November 11-13, 2018

Wireless Network Configuration Network Name: Marriott_CONFERENCE (only for laptop) Passcode: usc2018

Outline 1. Introduction to Linux 2. Basic Commands 3. Relative & Absolute Path 4. Redirect, Append and Pipe 5. Text Editor 6. Some Tips 7. HPC Cluster and SLURM

Introduction to Linux Kernel & Shell Like Windows, Linux is an operating system (OS). Linux consists of kernel & shell. User Kernel is the main part of Linux system that controls hardware, CPU, memory, storage disks, network etc. Shell is a program to bridge between users and the kernel. Users use commands to tell what you want to do to the kernel. input Shell Kernel

Introduction to Linux Text-based Command Line Interface (CUI) - No mouse but keyboard. User needs to type series of commands to tell computer what you want to do. Case Sensitivity - Unix is case-sensitive. MYFILE.doc, Myfile.doc and myfile.doc are all different files. Normal and Super users - One special user for administration who can do anything, called root or super user. - Others are normal accounts

Introduction to Linux Directory Structure - Directory (like folder in Windows) are organized in a hierarchical tree structure. - Top directory is / (slash or root). - Users have the own directory (home directory). - User and system directories.

Basic Commands ls cd cp mv rm pwd mkdir rmdir less man history List file and directory Change directory Copy file or directory Move file or directory Remove file or directory Display current directory Create directory Remove directory Display contents of text file, press q to exit. Display online manual Display your command history

Basic Commands (Cont.) How to use Linux commands? When you log on a Linux computer, you will see, [rajak@hpc-login3 ~]$ This is called command prompt and it means that Linux is ready for your inputs. A Linux command usually consists of three parts, command name, options, and arguments. Example) [rajak~]$ ls l.bashrc

Basic Commands (Cont.) Whitespace is necessary between command name, options and arguments. Options start with - Example) mkdir mydir rm test.txt cp. bashrc test.txt ls l.bashrc

Basic Commands (Exercise) 1. Type following commands and observe difference in their outputs. ls ls la ls a ls -Fa 2. Make a directory and change current position. mkdir testdir pwd cd testdir pwd cd pwd rmdir testdir

Basic Commands (Exercise) 3. In your home directory, ls.bash_profile cp.bash_profile sample.txt less sample.txt (press q key to exit) mv sample.txt sample2.txt rm sample2.txt 4. Check disk usage df df h du du h du -sh

Relative & Absolute Path path is a location in the directory tree. To specify a path, you can use two different expressions, relative or absolute path. With a relative path, a location is specified relative to your current location. With an absolute path, a location is specified from the top of the directory tree.

Relative & Absolute Path (Cont.) In relative path,. current directory.. parent directory Example) cd example1 pwd cd /auto/hpc-23/rajak/example2 Absolute path alsways starts with / Example) cd /Users/rajak /Users/rajak/file.txt

Relative & Absolute Path (Cont.) Relative path example In home directory, type following command to observe how output of pwd command changes. pwd cd. pwd cd.. pwd cd.. pwd cd Absolute path example From your home directory, try to move two directories up using absolute path. Example) pwd cd /Users/rajak pwd cd /Users pwd

Redirect, Append and Pipe Redirect and append Output from command is usually displayed on screen. Using >, you can redirect the output from screen to a file. Using >> you can append the output to the bottom of the file. Pipe Some commands require input from a file or other commands. Using, you can use output from other command as input to other command.

Redirect, Append and Pipe head shows first several lines. tail shows last several lines. grep shows lines matching a given pattern.

Redirect, Append and Pipe (Exercise) 1. In your home directory, copy.bash_profile to sample.txt for this exercise. ls.bash_profile cp.bash_profile sample.txt less sample.txt 2. Redirect example head n 3 sample.txt head n 3 sample.txt > redirect.txt

Redirect, Append and Pipe (Exercise) 3. Append example tail n 3 sample.txt tail n 3 sample.txt >> redirect.txt less redirect.txt 4. Pipe example less redirect.txt grep PATH redirect.txt tail redirect.txt grep PATH rm sample.txt rm redirect.txt

Text Editor Files that store input parameters are in text format. You must know how to edit text files on Linux. Two popular text editors, vi and Emacs, are widely used, though they are too complicated for Linux beginners. nano is an easy and simple to use, good for new users.

Text Editor (Cont.) Arrow-keys Enter Delete CTRL+x Move cursor Change line Delete a character Save data and exit nano Open a new file to edit with nano. > nano hello.txt You will see screen like on the right

Text Editor (Cont.) Step 1: Type Hello! Step 2: Save & Close the file by pressing CTRL and x keys together. Press y to save your edit. Step 3: nano will ask filename to be written. Press Enter key.

Text Editor (Cont.) CTRL+w CTRL+d CTRL+k CTRL+u CTRL+a CTRL+e CTRL+v CTRL+y Search Delete a character Remove a line Paste text in buffer Move to the beginning of line Move to the end of line Move forward one page Move backward one page

Text Editor (Cont.) Write a hello world program, compile and runt it. 1. Open hello.f90 with nano > nano hello.f90 2. Type in following Fortran code, save your edit and close the file. 3. Compile the code. > gfortran hello.f90 4. Run it. >./a.out Program Hello write(*,*) Hello World stop end

Compiling & Running Programs You need to compile your source codes (text file) into an executable (binary file) so that computer can understand how to execute it. gcc/icc : C compilers > gcc main.c gfortran/ifort : Fortran compiler > ifort main.f90

Compiling & Running Programs If the compilation is successful done, you will see a file called a.out, which is default user-compiled executable filename. To run the program, type >./a.out hello!

USC High-Performance Computing (HPC) Center Carol Little (CAL) building University Park Campus

Simple Linux Utility for Resource Management (SLURM) sbatch - submit SLURM job to HPC cluster --ntasks=1 --time=60 --output=md.out Output file --job-name=t0.3 job name Number of tasks you have how long (in minuites) you want to run your job

Job Monitor/Cancel : squeue & scancel squeue - show status of SLURM batch jobs -a all jobs are displayed -u username display status of specific user s job -l display job information in detail > sbatch myjob.sh Submitted batch job 1829927 > squeue -u knomura JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) 1829927 quick myjob.sh knomura R 0:03 1 hpc1411

Job Monitor/Cancel : squeue & scancel scancel - delete running job scancel jobid delete a job > scancel 1829927 > squeue -u knomura JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)