Linux Bootcamp Fall 2015

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

Linux Command Line Primer. By: Scott Marshall

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

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

Introduction to Linux

Lab Working with Linux Command Line

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

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

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

Chapter-3. Introduction to Unix: Fundamental Commands

Command Line Interface The basics

Introduction. File System. Note. Achtung!

Computer Systems and Architecture

Chap2: Operating-System Structures

Introduction: What is Unix?

CS CS Tutorial 2 2 Winter 2018

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.

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

CSCI 2132 Software Development. Lecture 4: Files and Directories

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

Lab 2: Linux/Unix shell

CHEM5302 Fall 2015: Introduction to Maestro and the command line

Introduction to Linux

Linux Essentials. Smith, Roderick W. Table of Contents ISBN-13: Introduction xvii. Chapter 1 Selecting an Operating System 1

A Brief Introduction to the Linux Shell for Data Science

Introduction To. Barry Grant

Linux Introduction Martin Dahlö Valentin Georgiev

Short Read Sequencing Analysis Workshop

Introduction to Linux. Fundamentals of Computer Science

The Shell. EOAS Software Carpentry Workshop. September 20th, 2016

Session 1: Accessing MUGrid and Command Line Basics

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

Introduction to Linux for BlueBEAR. January

User Guide Version 2.0

Introduction to Linux

unix intro Documentation

Advanced Linux Commands & Shell Scripting

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

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

Chapter 4. Unix Tutorial. Unix Shell

Introduction to Unix: Fundamental Commands

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

Unix Tutorial Haverford Astronomy 2014/2015

Introduction to UNIX I: Command Line 1 / 21

MBV4410/9410 Fall Bioinformatics for Molecular Biology. More Unix

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

Recap From Last Time: Setup Checklist BGGN 213. Todays Menu. Introduction to UNIX.

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

Unix Workshop Aug 2014

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

Practical Session 0 Introduction to Linux

Recap From Last Time:

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

BGGN 213 Working with UNIX Barry Grant

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

The Command Shell. Fundamentals of Computer Science

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

CS370 Operating Systems

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

Perl and R Scripting for Biologists

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

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

Reading and manipulating files

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

Introduction to Linux

Computer Systems and Architecture

A Brief Introduction to Unix

Linux Introduction Martin Dahlö

The Unix Shell. Pipes and Filters

Lab 1 Introduction to UNIX and C

Introduction to the Linux Command Line January Presentation Topics

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

Scripting Languages Course 1. Diana Trandabăț

Mills HPC Tutorial Series. Linux Basics I

Working with Basic Linux. Daniel Balagué

Operating Systems. Copyleft 2005, Binnur Kurt

Introduction to Linux

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

Getting Started With UNIX Lab Exercises

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

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

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

Unix Essentials. BaRC Hot Topics Bioinformatics and Research Computing Whitehead Institute October 12 th

INSE Lab 1 Introduction to UNIX Fall 2017

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

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

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

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.)

CISC 220 fall 2011, set 1: Linux basics

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

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi and Cyrill Stachniss

Introduction to Linux and Supercomputers

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

Lab 1 Introduction to UNIX and C

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

COSC UNIX. Textbook. Grading Scheme

Introduction of Linux

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

Transcription:

Linux Bootcamp Fall 2015 UWB CSS Based on: http://swcarpentry.github.io/shell-novice "Software Carpentry" and the Software Carpentry logo are registered trademarks of NumFOCUS.

What this bootcamp is: A brief introduction to Linux and how to use it within UWB CSS environment

What this bootcamp is NOT: In-depth overview of technical aspects of Linux

What is Linux? Perhaps, what is an Operating System?

What do you want to do? Whatever you do, you will need the help of the Operating System...

The Operating System Hardware: CPU, Screen, Mouse, Keyboard,... Operating System: Linux, Windows, MacOSX... Application: GUI/CLI, text editor, web browser,... Operator: Single User, Administrator, guest users, or another computer (machine to machine)

User Interaction Graphical User Interface Command Line Interface

The Command Line Interface (CLI) Prompt User@Computer:Directory$_ rafaelsi@uw1-320-01:~$_

Accessing the CLI (Locally) On MacOS: On Windows: Go to Applications -> Utilities -> Terminal Use Cygwin

Accessing the CLI (Remotely) On Windows: Run PuTTY with settings: Host: UW1-320-lab.uwb.edu Port: 1422 On MacOS: Type in the terminal: slogin -p 1422 NetID@UW1-320-lab.uwb.edu

Aside Regarding Remote Access You can also remotely access a computer s GUI. That is, make a remote computer s windows appear on your current machine. From a CLI, slogin with the -Y option will enable this. If we have time, we may demo this.

Basic Commands

CLI Structure: Read, Evaluate, Print, Loop NetID@uw1-320-01:~$ COMMAND -OPTIONS PARAMETERS OUTPUT NetID@uw1-320-01:~$ _ Some notes: Not all commands produce output to the screen. For some commands, getting nothing back means it worked. Parameters = usually needed; Options = usually optional

A Very Simple First Command: echo Learning objectives of this section: 1. Understand the syntax of a command 2. How to get help 3. What do options and parameters do

ECHO, Echo, echo... rafaelsi@uw1-320-01:~$ echo Hello World! Hello World! rafaelsi@uw1-320-01:~$ _

Sample Problem: How to Get the Following Input rafaelsi@uw1-320-01:~$ echo ############## dddd d ccc c bb b a a rafaelsi@uw1-320-01:~$ _

Getting Help: Command s Manual rafaelsi@uw1-320-01:~$ man echo rafaelsi@uw1-320-01:~$ help echo

Echo, Expressions and Backslash-Escaped Characters rafaelsi@uw1-320-01:~$ echo -e first Line \nsecond line first line second line rafaelsi@uw1-320-01:~$ _

Quiz About Formatted echo What do the following commands output? Why? echo "first\tline\nsecond\tline\n3rd\tline\nfourth\tline" echo -e "first line\nsecond line\n3rd line\nfourth line" echo -e "first\tline\nsecond\tline\n3rd\tline\nfourth\tline"

Back to the Sample Problem rafaelsi@uw1-320-01:~$ echo -e a\ta\nbb\tb\nccc\tc" dddd d ccc c bb b a a rafaelsi@uw1-320-01:~$ _

Echo, echo, echo... rafaelsi@uw1-320-01:~$ echo -e "dddd\td\nccc\tc\nbb\tb\na\ta" dddd d ccc c bb b a a rafaelsi@uw1-320-01:~$ _

Organizing Files

The File System

Current Working Directory: pwd What is a working directory? In a GUI OS, how do we know what the working directory is? Why does what works in a GUI not work in a CLI? What are the implications for navigating a file system?

Specifying Paths in a CLI Questions to share with your neighbor: What is a path? How do we specify a path in a GUI? What is the root directory in Linux? Why is there no equivalent directory in Windows?

Paths in Linux Path separator character is / Default is to assume a path is relative to the current working directory. Note the root directory symbol is the same as the path separator. Example: What s the difference between: echo /net/metis/home/rafaelsi/myfile echo net/metis/home/rafaelsi/myfile

The File System: Basic Navigating Commands To list files and directories: ls To change the current directory: cd Try this: 1) Log in the console, and list the files you have available. 2) Navigate into the MATLAB folder, located inside your Document directory 3) What do you find in there?

Special Navigating Symbols Parent Directory.. Root / Home ~ Current working Directory. Exercise: 1) How do you return to your home folder? Figure out three ways of doing this. 2) How would you extract the contents of a zipped archive into the /tmp folder?

Editing and Manipulating Files

Text Files and Linux How do you communicate between applications in Windows or Mac OSX? Text streams (and their file form) are fundamental to commands (tools) in Linux. Many Linux commands accept text as input and return text as output: creating text files and manipulating text streams is crucial. Many text editors exist to create text files: nano, vim, emacs, nedit, pico, etc.

File Editing (nano) ( ^A often means control-a.) Exercise: 1) Type nano in your terminal and add some content. 2) Save the changes as a new file, exit nano and list the file. 3) Re-open the file with nano, but enabling mouse support this time. (How would you find out how to do that?)

Outputting File Contents to Screen Print file content: cat Print file first lines: head Print file last lines: tail Print all contents page-by-page (Ctrl-f, b, g): less Exercise: 1) Display on the screen the file you create 2) Display just the last 3 lines of the same file 3) Display details of the OS (by inspecting the file /etc/os-release)

But First: Download Some Working Files Execute the following in your home directory: curl -o example.zip http://swcarpentry.github.io/shell-novice/shell-novice-data.zip Questions for the class: 1) What does the curl command do? (How did you find out?) 2) What does the option -o do, and what happens if we don t have it?

File System Manipulation Create a directory: mkdir Move (or rename) files: mv Copy files: cp Remove (or delete): rm Exercise: 1) How to extract zipped content? (I haven t told you the command; use whatever resources you need to find out what to use.) Extract the contents of the examples.zip file in your home directory. 2) How to rename the folder data to examples? 3) Go into examples/data. How would you make a copy of hardware. cfg and put it into the backup directory?

Quiz: What Results from the Following Commands cp file1 file2 rm /tmp/file1 cp../folder2/file. cd.

Manipulating Lots of Files: Wildcards Wildcards allow you to refer to filenames by matching any of one or more characters. The * symbol means any character(s) The? symbols means any single character Exercise: Go to the /tmp directory. How would you list all items that have the word test in their names? How would you list all items that start with thistest but are suffixed by a single number (e.g.,.2 )? Print to screen the contents of all files named alog and then a numeral.

A Motivating Example Why does the following doesn t copy all items in the directory nelle (from the files you downloaded)? cp Users/nelle/* Users/rick/.

Manipulating Directories By default, standard file manipulation commands (i.e., cp, rm, mv) act on files only. They do not affect directories. The -r option affects all sub-directories specified, recursively to the leaves of the tree. Be careful! Use -i to force a confirmation.

Exercise for Manipulating Directories Do the following: Copy examples to examples_copy. Go into examples_copy. Delete the user sub-directory. Make a copy of data in each of the user directories in User. Delete the examples_copy/data directory, with Linux first confirming whether this is what you want to do before it does the deletion.

Piping and Redirection

Linux and the Tools Philosophy Application philosophy : One, big program that tries to do many (related) things. Tools philosophy : Many, small programs that each do only one thing (well), that can be arbitrarily connected together to do (nearly) anything. Connecting requires: A connection medium: In Linux, the medium is a text stream (input and output). Things that connect: In Linux, pipes and redirectors do this.

Piping and Redirection Symbols > Saves output to a file >> Appends output to a file < Redirects input from a file Pipes or redirects: Output from one command as input into another

Examples of Piping and Redirection (In these examples, I m assuming you re in /tmp/examples.) Send output to a file: ls -1 > allfiles Append output to a file: cat hello >> allfiles Receive input from a file: grep What < hello Take output from one command and use it as input to another command: ls -1 wc -l

Exercise in Piping and Redirection How would you count the number of files in the current directory? How would you save (as a single column text files) the names of all files that include the word alog? Search the file longfile and save, in another file, only those lines that have the phrase physics.

Exercise in Piping and Redirection (Answers) (I m assuming you re in /tmp/examples.) How would you count the number of files in this directory? ls -1 wc -l How would you save (as a single column text files) the names of all files that include the word alog? ls -1 *alog* > listofnames Search the file longfile and save, in another file, only those lines that have the phrase physics : grep physics longfile > listofme

A Short Aside on Job Control Exit a text stream input: Ctrl-d Kill the current process: Ctrl-c Kill a process from elsewhere: kill -9 pid (You can get the process ID (pid) from ps or top.)