CSE 303 Concepts and Tools for Software Development

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

The Linux Shell The shell contains
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
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.
1 CSE 303 Lecture 4 users/groups; permissions; intro to shell scripting read Linux Pocket Guide pp , 25-27, 61-65, , 176 slides created by.
Lesson 22 – Introduction to Linux Systems Administration.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
LINUX COMMAND LINE INTERFACE Lab 3 EECS 448 Dr Fengjun Li and Meenakshi Mishra.
Introduction to Linux and Shell Scripting Jacob Chan.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
Linux+ Guide to Linux Certification, Third Edition
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Introduction to Programming Using C An Introduction to Operating Systems.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2 – Processes, Programs, the Shell (& emacs)
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2014 Lecture 3 – I/O Redirection, Shell Scripts.
1 CSE 390a Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 10/9/2006 Lecture 6 – String Processing.
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
CIRC Winter Boot Camp 2017 Baowei Liu
CSE 374 Programming Concepts & Tools
slides created by Marty Stepp, modified by Josh Goodwin
Getting started with CentOS Linux
Shell Features CSCI N321 – System and Network Administration
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
CSE 374 Programming Concepts & Tools
CSE 374 Programming Concepts & Tools
CSE 374 Programming Concepts & Tools
Some Linux Commands.
C151 Multi-User Operating Systems
The Command Prompt Commands are the way to “do things” in Unix
CSE 374 Programming Concepts & Tools
CSE 303 Concepts and Tools for Software Development
Basic UNIX OLC Training.
Using Linux Commands Lab 3.
Operating Systems and Using Linux
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
Introduction to Linux Week 0 - Thursday.
CSE 390a Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller.
slides created by Marty Stepp, modified by Jessica Miller
Web Programming Essentials:
Operating Systems and Using Linux
UNIX Reference Sheets CSE 2031 Fall 2010.
Getting started with CentOS Linux
CSE 390a Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller.
CSE 303 Concepts and Tools for Software Development
Linux Shell Script Programming
slides created by Marty Stepp, modified by Jessica Miller
CSE 390a Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller.
CSE 390a Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller.
CSE 390a Lecture 3 bash shell continued: processes; multi-user systems; remote login; editors slides created by Marty Stepp, modified by Jessica Miller.
Operating Systems and Using Linux
Introduction to Bash Programming, part 3
Presentation transcript:

CSE 303 Concepts and Tools for Software Development CSE 303 Lecture 2 9/29/2006 CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 9/29/2006 Lecture 2 – Linux and Shells

Homework 0 is past due! If you missed it, let us know You’ll need one of your late-days If you had problems, let us know We assume it all worked 9/29/2006 CSE 303 Lecture 2

Last Time Getting the lay of the land Lot of material fast Shell (bash) Directory structure, sense of place (pwd) Commands Viewing/Editing text files (emacs, cat, less) Manipulating Files/Dirs (mkdir, cp, mv, rm) Changing permissions (chmod) Lot of material fast Don’t worry, we’ll cover it all in greater depth 9/29/2006 CSE 303 Lecture 2

Today Shell as an interpreter Shell model (Files, Users, Proceses) Shell language details Expansions History Access Aliases Command-line editing 9/29/2006 CSE 303 Lecture 2

How to think about the shell Interprets a language Language: program names, arguments Interpreter actions Runs program Passes arguments Prints output Waits for next command Program Capabilities Control filesystem Control devices: network (mail), display (windows) Launch other programs Like Java? 9/29/2006 CSE 303 Lecture 2

Shell Programming Model Files Users Processes We’ve already looked at files 9/29/2006 CSE 303 Lecture 2

Users 1 file-system, 1 OS, 1 CPU, many users Users have Names (whoami, who) Passwords (/etc/passwd) Home directory (and quotas) Default shell (~/.bash_profile) Groups 9/29/2006 CSE 303 Lecture 2

Permissions Permissions Changing Permissions: chmod Superuser: root For every file and directory (ls –a) For user (chown), group (chgrp), and others Read, write, or execute Change with chmod Changing Permissions: chmod Example: chmod –R go-rw Superuser: root 9/29/2006 CSE 303 Lecture 2

Processes Process = running program “Applications” can have many Shell is a process (ends on exit) Default: shell waits for process to finish Great for ls Bad for emacs (need emacs&, or ^z bg) Commands for controlling processes jobs, fg, bg, kill, ps top 9/29/2006 CSE 303 Lecture 2

Shell model is simple, really… Model = files, users, processes GUIs hide this Programmers need to get to it Where complexity comes from I/O Devices (network, display, keyboard, etc.) Language Designed for fast typing Designed for quick and dirty scripting 9/29/2006 CSE 303 Lecture 2

The shell language Words and spaces → Call prog w/ args Types of words (not an exhaustive list) Built-ins (cd, type) Program names (ls, cat) Program arguments (-R, file.txt) Expansions (filename wildcards, braces) History access Aliases Pipes and redirections Shell and environment variables Programming constructs (if, loops, arrays, exprs.) 9/29/2006 CSE 303 Lecture 2

Filename Wildcard Expansion Words can expand to multiple filenames ~uname → home directory of “uname” ~ → current user’s home directory * (by itself) → all files in current directory Except those starting with “.” * → matches 0 or more filename characters ? → matches 1 filename character [abc],[a-z] → any character in set, range [!a],[^a] → any character not in set, range This happens before passing to program 9/29/2006 CSE 303 Lecture 2

Why use file wildcards? When typing In scripts Saves time In scripts Helps if you don’t know what files are present cat * - to get all files in a directory What if you want special characters? Use quoting "*" Use escaping \* 9/29/2006 CSE 303 Lecture 2

Brace Expansion Create multiple strings from single string Not just for file names Example Typed: echo Garbage{In,Out} Expanded: echo GarbageIn GarbageOut 9/29/2006 CSE 303 Lecture 2

History Access List of all commands typed Syntax Way to see what you’ve done Shortcut for repeating previous commands Not so useful in scripts Syntax history !c – repeat last command starting with “c” !! – repeat last command 9/29/2006 CSE 303 Lecture 2

Aliases Shorthand for frequently typed commands Usually put in ~/.bashrc Different from variables (see these later) Syntax Define alias alias ll=“ls -l” View alias alias ll or type ll Remove alias unalias ll 9/29/2006 CSE 303 Lecture 2

More word types Most interesting yet to come! Pipes and redirections Shell and environment variables Programming constructs We’ll cover these in more detail later 9/29/2006 CSE 303 Lecture 2

Command Line Editing Shortcuts for navigating/editing commands Extremely helpful when typing Especially in terminals (e.g. when no arrow keys) No help in scripts Bash similar to emacs Interesting cases Up/Down arrows: access command history Tab: Filename completion (space in emacs) C-s: Stops displaying output until C-q 9/29/2006 CSE 303 Lecture 2

Summary Environment: files, users, processes Use shell to manipulate environment Command line Scripts Shell language Commands and built-ins Program options and arguments Expansions, history, aliases Command-line editing 9/29/2006 CSE 303 Lecture 2

Reading Linux Pocket Guide Bash Reference Manual Read Skim p1-33 (Intro, Basics) p104-107 (Viewing Processes) p110-114 (Users and Their Environment) Skim p37-46, 60-63 (for commands used in lectures) Bash Reference Manual See “Computing Resources” on web page Skim sections 8.4.1-8.4.4 (Command-line editing) 9/29/2006 CSE 303 Lecture 2

Next Time Combining Commands Quoting and escaping Variables I/O redirection Logic expressions Quoting and escaping Variables Shell scripting introduction 9/29/2006 CSE 303 Lecture 2