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

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

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

CSE 390a Lecture 1. introduction to Linux/Unix environment

CSE 391 Lecture 1. introduction to Linux/Unix environment

CSE 391 Lecture 1. introduction to Linux/Unix environment

Intro to Linux & Command Line

Perl and R Scripting for Biologists

Chapter-3. Introduction to Unix: Fundamental Commands

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Introduction to Unix: Fundamental Commands

Introduction to UNIX command-line

Introduction to Linux. Fundamentals of Computer Science

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

Week 2 Lecture 3. Unix

Practical Session 0 Introduction to Linux

Files

CSCI 2132 Software Development. Lecture 4: Files and Directories

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

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

Linux Command Line Primer. By: Scott Marshall

Introduction to Linux

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

Introduction to Linux

Chapter 4. Unix Tutorial. Unix Shell

Multiple Choice - 58 Questions - 10 of 15%

Laboratory 1 Semester 1 11/12

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 UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

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

A Brief Introduction to Unix

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

Unix Handouts. Shantanu N Kulkarni

CENG 334 Computer Networks. Laboratory I Linux Tutorial

The Unix Shell. Pipes and Filters

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

Unix Tutorial Haverford Astronomy 2014/2015

A Brief Introduction to the Linux Shell for Data Science

Files and Directories

Commands are in black

Linux Essentials Objectives Topics:

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

Operating Systems. Copyleft 2005, Binnur Kurt

Computer Systems and Architecture

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

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

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

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

Lab 2: Linux/Unix shell

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

Scripting Languages Course 1. Diana Trandabăț

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Computer Systems and Architecture

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 command-line II

Linux File System and Basic Commands

Introduction of Linux

COSC UNIX. Textbook. Grading Scheme

Mills HPC Tutorial Series. Linux Basics I

Introduction to Linux Workshop 1

Introduction to Supercomputing

Chapter 1 - Introduction. September 8, 2016

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

Introduction to the UNIX command line

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Command-line interpreters

COMS 6100 Class Notes 3

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Introduction: What is Unix?

This is Lab Worksheet 3 - not an Assignment

UNIX System Programming Lecture 3: BASH Programming

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

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

Linux & Shell Programming 2014

5/8/2012. Exploring Utilities Chapter 5

CS197U: A Hands on Introduction to Unix

Guided Tour (Version 3.3) By Steven Castellucci as Modified by Brandon Haworth

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

Getting your department account

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Linux Systems Administration Getting Started with Linux

The UNIX Operating System. HORT Lecture 2 Instructor: Kranthi Varala

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

Getting Started With UNIX Lab Exercises

CS 300. Data Structures

An Introduction to Cluster Computing Using Newton

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

On successful completion of the course, the students will be able to attain CO: Experiment linked. 2 to 4. 5 to 8. 9 to 12.

Command Line Interface The basics

Introduction to Linux

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

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

Overview of the UNIX File System. Navigating and Viewing Directories

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.

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

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

Computer Architecture Lab 1 (Starting with Linux)

Transcription:

CSE 303 Lecture 2 Introduction to bash shell read Linux Pocket Guide pp. 37-46, 58-59, 60, 65-70, 71-72, 77-80 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1

Unix file system structure Lecture summary basic shell s s for file manipulation, examination, searching keyboard shortcuts and special characters 2

Unix file system directory / /bin /dev /etc /home /media, /mnt,... /proc /tmp, /var /usr root directory that contains all others (drives do not have letters in Unix) programs hardware devices system configuration files /etc/passwd stores user info /etc/shadow stores passwords users' home directories drives and removable disks that have been "mounted" for use on this computer currently running processes (programs) temporary files user-installed programs 3

Relative directories directory... ~ ~username ~/Desktop the directory you are in ("working directory") the parent of the working directory (../.. is grandparent, etc.) your home directory (on many systems, this is /home/username ) username's home directory your desktop 4

Shell s many accept arguments or parameters example: cp (copy) accepts a source and destination file path a program uses 3 streams of information: stdin, stdio, stdout (standard in, out, error) input: comes from user's keyboard output: goes to console errors can also be printed (by default, sent to console like output) parameters vs. input parameters: before Enter is pressed; sent in by shell input: after Enter is pressed; sent in by user 5

Directory s ls pwd cd mkdir rmdir list files in a directory output the current working directory change the working directory create a new directory delete a directory (must be empty) some s (cd, exit) are part of the shell ("builtins") others (ls, mkdir) are separate programs the shell runs 6

Command-line arguments most options are a - followed by a letter such as -c some are longer words preceded by two - signs, such as --count parameters can be combined: ls -l -a -r can be ls -lar many programs accept a --help or -help parameter to give more information about that (in addition to man pages) or if you run the program with no arguments, it may print help info for many s that accept a file name parameter, if you omit the parameter, it will read from standard input (your keyboard) note that this can conflict with the previous tip 7

Shell/system s man or info clear exit date, time cal uname get help on a clears out the output from the console exits and logs out of the shell output the system date/time output a text calendar print information about the current system "man pages" are a very important way to learn new s man ls man man 8

File s cp mv rm touch copy a file move or rename a file delete a file create a new empty file, or update its last-modified time stamp caution: the above s do not prompt for confirmation easy to overwrite/delete a file; this setting can be overridden (how?) Exercise : Given several albums of.mp3 files all in one folder, move them into separate folders by artist. Exercise : Modify HW4.java to make it seem as though you finished writing it on March 15 at 4:56am. 9

File examination cat more or less head, tail wc du diff output a file's contents on the console output a file's contents, one page at a time output the first or last few lines of a file count words, characters, and lines in a file report disk space used by a file(s) compare two files and report differences Suppose you are writing a paper, and the teacher says it can be anything as long as it is at least 200 words long and mentions 303... 10

Searching and sorting grep sort uniq find locate which search a file for a given string convert an input into a sorted output by lines strip duplicate lines search for files within a given directory search for files on the entire system shows the complete path of a grep is actually a very powerful search tool; more later... Exercise : Given a text file students.txt, display the students arranged by the reverse alphabetical order of their last names. Can we display them sorted by first name? 11

Programming javac ClassName.java java ClassName python, perl, ruby, gcc, sml,... run a Java program compile a Java program compile or run programs in various other languages Exercise : Write/compile/run a program that prints "Hello, world!" $ javac Hello.java $ java Hello Hello, world! $ 12

Keyboard shortcuts " * Tab ^C or ^\ ^D ^Z ^S key Up arrow Home/End or ^A/^E ^KEY means hold Ctrl and press KEY repeat previous s move to start/end of current line quotes surround multi-word arguments and arguments containing special characters "wildcard", matches any files; can be used as a prefix, suffix, or partial name auto-completes a partially typed file/ name terminates the currently running process end of input; used when a program is reading input from your keyboard and you are finished typing suspends (pauses) the currently running process don't use this; hides all output until ^G is pressed 13

Links ln unlink create a link to a file remove a link to a file hard link: Two names for the same file. $ ln foo bar the above links bar as a duplicate name for foo if one is modified, the other is too; if one is deleted, both will go away soft (symbolic) link: A reference to another existing file. $ ln -s foo bar the above creates a reference bar to the file foo bar can be used as though it were foo but if bar is deleted, foo will be unaffected 14