Week 5 Lesson 5 02/28/18

Similar documents
find starting-directory -name filename -user username

Week 8 Lesson 8 03/21/18

5/20/2007. Touring Essential Programs

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.

Part I. UNIX Workshop Series: Quick-Start

EECS2301. Lab 1 Winter 2016

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

UNIX Essentials Featuring Solaris 10 Op System

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

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

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University

Overview of the UNIX File System

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

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.

CSC UNIX System, Spring 2015

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

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

Introduction: What is Unix?

Perl and R Scripting for Biologists

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

CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Introduction to Linux

CSCI 2132 Software Development. Lecture 4: Files and Directories

Review of Fundamentals

Command-line interpreters

Commands are in black

CENG 334 Computer Networks. Laboratory I Linux Tutorial

UNIX System Programming Lecture 3: BASH Programming

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

System Programming. Introduction to Unix

Overview of the UNIX File System. Navigating and Viewing Directories

System Programming. Unix Shells

Please note that CNE 216 is a brand new course that has never been taught on the George campus; it will be taught for the first time in the fall of

CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)

Lab 1: Accessing the Linux Operating System Spring 2009

Introduction to the shell Part II

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

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

LOG ON TO LINUX AND LOG OFF

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

Project 1: Implementing a Shell

Computer Systems and Architecture

Unix. Examples: OS X and Ubuntu

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

Linux for Beginners. Windows users should download putty or bitvise:

Basic Shell Commands. Bok, Jong Soon

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

Module 8 Pipes, Redirection and REGEX

COL100 Lab 2. I semester Week 2, Open the web-browser and visit the page and visit the COL100 course page.

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

Lab 2: Linux/Unix shell

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Files

Mills HPC Tutorial Series. Linux Basics I

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description:

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

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

Introduction to Linux

Operating Systems. Copyleft 2005, Binnur Kurt

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

COSC UNIX. Textbook. Grading Scheme

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

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

Vi & Shell Scripting

UNIX and Linux Essentials Student Guide

Course 144 Supplementary Materials. UNIX Fundamentals

Introduction To. Barry Grant

Unix Introduction to UNIX

Outline. Structure of a UNIX command

University of Windsor : System Programming Winter Midterm 01-1h20mn. Instructor: Dr. A. Habed

bash, part 3 Chris GauthierDickey

CS197U: A Hands on Introduction to Unix

The Online Unix Manual

Basics. I think that the later is better.

CSCI2467: Systems Programming Concepts

Practical 5. Linux Commands: Working with Files

CS4350 Unix Programming. Outline

The kernel is the low-level software that manages hardware, multitasks programs, etc.

A shell can be used in one of two ways:

Practical Session 0 Introduction to Linux

Linux & Shell Programming 2014

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

This is Lab Worksheet 3 - not an Assignment

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

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

Advanced training. Linux components Command shell. LiLux a.s.b.l.

Chapter 1 - Introduction. September 8, 2016

Filesystem and common commands

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1

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.

Getting your department account

UNIX files searching, and other interrogation techniques

Chapter 9. Shell and Kernel

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

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

M2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE

List of Linux Commands in an IPm

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

Transcription:

Week 5 Lesson 5 02/28/18 Important Announcements Extra Credits If you haven t done so, send your pictures to risimms@cabrillo.edu for 3 points EXTRA CREDIT. Join LinkedIn for 3 points Perkins/VTEA Survey (check forum) for 3 point extra credit Class Attendance Attending class by watching the recording in the archives? Make sure you email the instructor for attendance First minute quizzes: 9AM Log in credentials are your usernames and passwords. See instructor s welcome announcement on CANVAS Text Book Text book is optional: Harley Hahn s Guide to Unix and Linux by Harley Hahn, McGraw- Hill ISBN: 0073133612 Exams (see calendar) FINAL EXAM WILL BE ON WEDNESDAY, MAY 23 FROM 7:00 AM-9:50 Forum USE FORUM if needed help (remember extra posts in one quarter do not carry over to the next quarter) Time zone Class uses Opus-ii time. For more info, ask on forum. Grade Keep track of your grade Networking Subscribe to Cabrillo Networking Program Mailing list. Send email to networkerssubscribe@cabrillo.edu Review for Test 1 PRACTICE TEST #1 IS AVAILABLE ON CANVAS (SEE SLIDE 205) Tips to study/taking open book test - Create your own reference sheet - For each subject include a small example. Six Steps of the Shell Review - Which shell are you using? Try these commands (slide 27)

o ls /bin/ {?,??}sh o grep [username] /etc/passwd o ps o echo $SHELL - There are many shells on Opus-II. They can be found in the /bin directory. Your account entry in /etc/passwd determines which shell you will use. - Prompt, Parse, Search, Execute, Nap, Repeat are the six steps of the Shell (slide 28) o See slide 29 for an example of the shell and a command working together as a team and a table indicating each step the command is running 1. Prompt a. The shell prompts user for a command i. Every time you his the enter key, the shell will prompt you for another command (see slide 30 for example) b. The shell uses the value of PS1 variable to make the prompt. i. echo $PS1 c. You can manually do the same thing by echoing the value of the PS1 variable i. Echo $PWD $ (see slide 31 for example) ii. Your PS1 variable on Opus-II gets set when you login via a login script containing this command: PS1= $PWD $ 2. Parse a. The shell parses what you entered and identifies the command, the options, the arguments and any redirection. (see slides 32-35 for examples) b. Use the echo * to out how many arguments 3. Search a. The shell searches the path for the command you entered (see slide 36) b. To see where the shell finds the command, type this command: type [command] or echo $PATH (grep add color to semicolons) 4. Execute a. The shell executes the command program (see slides 37-38) b. The program on the hard drive becomes a process in memory with a unique PID (Process ID). Each new process is given three file descriptors stdin, stdout and stderr for input and output purposes. Theses are sometimes referred as the three standard IO (Input/Output) streams. 5. Nap a. The shell sleeps while the command runs. The nap ends when the file command has finished 6. Repeat a. The shell does it again for the next command Directories on your Path (see slides 44-53) - /bin:/sbin:/usr/bin:/usr/sbin:usr/local/bin (MEMORIZE these directories. You should have them on your path for this course). o If one of these directories missing from your path look for before - How to fix/reset a broken PATH:

o PATH=[the missing directories]:$path (see slide 49) Everything is a file in Unix and you can write to them. Even a terminal (see slides 74-84 for example and slide 76 for file types) File Name Expansion. Also known as globbing - Filename expansion Metacharacters o * matches all non-hidden fienames in the current directory when used alone or zero or more characters when used as a prefix, infix or postfix. o? matches any single character in any of your current directory s filenames. o [ ] matches any single character contained within the brackets. Shell Parse Step - Filename expansion happens during the shell parsing step, before the command is even located or executed. The commands never see *,?, and [ ] characters. They get replaced by the shell before the command is even located and executed The *Filename Expansion Metacharacter (see slides 88-91) - Example: text.* will be expanded by the shell to match any files that start with text. - Example: * is expanded to match all directories in /home/cis90 and ti* to match all files starting with ti : ls -l../*/poems/blake/ti* - *.* is expanded to match all files in the current directory containing. - The * by itself does not match any hidden files in your current working directory The? Filename Expansion Metacharacter (see slide 92) - Example??? will be matching any three characters file name The [ ] Filename Expansion Metacharacter (see slide 93) - Example: [12] will be match a 1 or a 2 For practice questions on all three filenames see slides 94-104 Command Review Lesson 1 commands: - cal show calendar - cat /etc/issue usually shows distro (distribution) name - cat /etc/*-release usually shows distro (distribution) name - clear clear the terminal screen - date show current time and date - exit terminate your shell and log off - history show previous commands - hostname show the name of the computer being accessed - id show user and group id information - ps show processes (loaded programs) being run - ssh secure login to a remote system - uname show kernel name

o use -r to see which release of the kernel is running on your system - tty show terminal device - who show everyone logged in - who am i identifies which login session you are using Lesson 2 commands: - echo Prints text and variables - banner Make a banner - ls list directory contents - cat View file (name comes from concatenate) - file Show additional information about a file - type Shows where a command resides on the path - apropos Searches the whatis database for strings - whatis Searches the whatis database for commands - man Show the manual page for a command - info Alternate online documentation tool - bc Binary calculator - passwd Change password - set List all shell variables - env List all environment variables New Files and Directories: - /etc/passwd user accounts - /etc/shadow encrypted passwords - /bin directory of commands - /sbin directory of superuser commands - /usr/bin directory of commands, tools and utilities - /usr/local/bin custom local commands Lesson 3 commands: - mail UNIX mail o <integer> print specific message specified by <integer> o [Enter key] print next message o p <message list> print messages o d <message list> delete messages o s <message list> file save (append) messages to file o u <message list> undelete messages o R <message list> reply to sender o r <message list> reply to all o m <user list> mail to specific users o q quit saving changes o x exit without saving changes o h print message headers o z or z- scroll forward or backward through headers

- mesg enable or disable writes to your terminal - write write message to another user - irssi IRC chat client New Files and Directories: - /var/mail Message store for mail - /var/mail/username Incoming mailbox for username - mbox File in users home directory where read messages are archived to Lesson 4 commands: - cat view a text file - more view a large text file by scrolling down - less view a large text file by scrolling down and up - head view the beginning lines of a text file o use the -n <number> option to control the number of lines printed - tail view the last lines of a text file o use the -n <number> option to control the number of lines printed - wc count the lines, words and characters in a text file o e.g /home/cis90/simben $ wc letter 28 # lines; 182 # words; 1044 # bytes o Use -l option to count just the number of line o Use -w option to count just the number of words - xxd view a binary data file as a hex dump - cd change to a different directory - ls list files - pwd show name of current/working directory - file show additional file information - type show location of a command on path New File and Directories: - / slash directory, the root of the file tree - /home User home directories - /home/cis90 CIS 90 class home directories - /home/cis90/username The home directory for CIS 90 student username - /etc/passwd The absolute pathname of the passwd file in the /etc/ directory Command Syntax: - -Prompt -Command -Options -Arguments -Redirection (slides 112-123) See slide 125 for Metacharacters review. Environment Variables (see slides 134-141) - HOME Users home directory - LOGNAME User s username for logging in with

- PATH List of directories, separated by : s, for the shell to search for commands - PS1 The prompt string - PWD Current working directory - SHELL Name of the Shell program being used. - TERM Type of terminal device, e.g. dumb, vt100, xterm, ansi, etc. See slides 142 149 for example on life of the shell step 4, Execute. File Systems (see slides 154-160) - The three elements of a UNIX file o -filename -inode -data Absolute Pathnames starts with from / Relative Pathnames starts from your current location in the tree See slide 163 for the Top Level Directories list. Flash cards are available on the website. You will need to create an account: username and password (see slides 172-173) See slides 175-201 for test tips and practice questions DO THE PRACTICE TEST (Slide 203)