CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2

Size: px
Start display at page:

Download "CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2"

Transcription

1 CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 2 Prof. Michael J. Reale Fall 2014

2 COMMAND KATA 7: VARIABLES

3 Command Kata 7: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata7 and go to it mkdir dkata7; cd dkata7 Make a script called kata7 script kata7 When we re done: exit

4 Command Kata 7: The Way of Bourne Start a Bash shell bash Create a shell variable BESTMOVIE= Supremacy Print value of variable echo ${BESTMOVIE} Start a new bash shell bash Print value of variable echo ${BESTMOVIE} Exit shell exit Make variable an environment variable export BESTMOVIE Start a new bash shell bash Print value of variable echo ${BESTMOVIE} Exit shell exit Exit shell again exit

5 Command Kata 7: The Way of the C (Shell) Start tcsh tcsh Create shell variable set ocean= Atlantic Print value of variable echo ${ocean} Create environment variable setenv OCEAN Pacific Start tcsh shell tcsh Print value of shell variable echo ${ocean} Print value of environment variable echo ${OCEAN} Exit shell exit Exit shell again exit

6 COMMAND KATA 8: REDIRECTION

7 Command Kata 8: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata8 and go to it mkdir dkata8; cd dkata8 Make a script called kata8 script kata8 When we re done: exit

8 Command Kata 8 Run cat cat Type some data and hit enter Press CTRL+D (EOF) Redirect cat output to myfile cat > myfile Type some multi-line data and press CTRL+D (EOF) Print contents of myfile cat < myfile Redirect myfile to STDIN and STDOUT to yourfile cat < myfile > yourfile Print contents of yourfile cat < yourfile

9 COMMAND KATA 9: MORNING TEE

10 Command Kata 9: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata9 and go to it mkdir dkata9; cd dkata9 Make a script called kata9 script kata9 When we re done: exit

11 Command Kata 9 Print list of users logged in who Pipe output of who to input of sort who sort Grab list of logged-in users before sorting who tee listwho sort Grab list of sorted logged-in users who sort tee listsort Print list of logged-in users cat listwho Print sorted list of logged-in users cat listsort

12 COMMAND KATA 10: CROSSING THE STREAMS

13 Command Kata 10: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata10 and go to it mkdir dkata10; cd dkata10 Make a script called kata10 script kata10 When we re done: exit

14 Command Kata 10: Bourne Start Bash bash Try to run make (should fail) make Redirect STDOUT make > outfile Redirect STDERR make 2> errfile Redirect both STDOUT and STDERR make > bothfile 2>&1 Print outfile cat outfile Print errfile cat errfile Print bothfile cat bothfile Remove files rm *file Exit Bash exit

15 Command Kata 10: C-Shell Start tcsh tcsh Try to run make (should fail) make Redirect both STDOUT and STDERR make >& bothfile Redirect STDOUT to outfile (subshell), then STDERR to errfile (make > outfile) >& errfile Print outfile cat outfile Print errfile cat errfile Print bothfile cat bothfile Remove files rm *file Exit tcsh exit

16 COMMAND KATA 11: #YESFILTER

17 Command Kata 11: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata11 and go to it mkdir dkata11; cd dkata11 Make a script called kata11 script kata11 When we re done: exit

18 Command Kata 11: Part 1 Open vi to create the file file1 vi file1 Hit i, and enter the following: ghi abc abc def def ESC, then SHIFT+ZZ to save and exit

19 Command Kata 11: Part 2 Print file1 cat file1 Get first 2 lines of file1 cat file1 head n2 Get last 2 lines of file1 cat file1 tail n2 Find abc in file1 cat file1 grep abc Get first column of file1 cat file1 cut d f 1 Get number of lines in file1 cat file1 wc l Get unique values and counts cat file1 uniq c Sort file1 cat file1 sort Count how many lines have abc cat file1 grep abc wc -l

20 COMMAND KATA 12: Time Travelling under an Assumed Name

21 Command Kata 12: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata12 and go to it mkdir dkata12; cd dkata12 Make a script called kata12 script kata12 When we re done: exit

22 Command Kata 12 Start a bash shell bash Create an alias to repeat the last command alias r= fc -s Create some files touch a1 a2 a3 Re-execute command, but with a replaced by b fc s a=b Re-execute command, but with b replaced by c r b=c See what files you have ls Remove all files beginning with a through c rm [a-c]* Check your history history Check your alias alias r Get rid of your alias unalias r Check it again alias r Exit bash exit

23 COMMAND KATA 13: Find and Execute

24 Command Kata 13: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata13 and go to it mkdir dkata13; cd dkata13 Make a script called kata13 script kata13 When we re done: exit

25 Command Kata 13 Find all regular files in your home find ~ -type f Find all directories in your home find ~ -type d Find all files beginning with kata find ~ -type f name kata* Print out contents of all kata files find ~ -type f name kata* exec cat {} \; Do same thing with xargs find ~ -type f name kata* xargs cat List long listing for all directories find ~ -type d exec ls ld {} \; Do same thing with xargs find ~ -type d xargs ls -ld

26 COMMAND KATA 14: UGO; I Stay

27 Command Kata 14: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata14 and go to it mkdir dkata14; cd dkata14 Make a script called kata14 script kata14 When we re done: exit

28 Command Kata 14 Make a file touch myfile Give ALL permissions chmod a=rwx myfile List long format ls l Remove read, write, execute from group and others chmod go-rwx myfile List long format ls l Add read and execute to group chmod g+rx myfile List long format ls l Set user permissions to equal group chmod u=g myfile List long format ls l Add write permissions to user AND add execute to others chmod u+w,o+x myfile List long format ls l

29 COMMAND KATA 15: Expressing Yourself Regularly

30 Command Kata 15: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata15 and go to it mkdir dkata15; cd dkata15 Make a script called kata15 script kata15 When we re done: exit

31 Command Kata 15 Copy dictionary file cp /usr/share/dict/words words Find all lines that end in e egrep e$ words Find all lines that begin with x egrep ^x words Find all lines that begin with x or y and end with e egrep ^[xy].*e$ words Find all lines that repeat a twice egrep a{2} words Find all lines that repeat e or s three times egrep (e{3} s{3}) words Find all lines that end in thing POSSIBLY followed by s egrep things?$ words Find all lines that end in one or more z egrep z+$ words

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1 CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1 Prof. Michael J. Reale Fall 2014 COMMAND KATA 0 Command Kata 0: Preparation First, go to ~/cs307 cd ~/cs307 Make directory dkata0 and go to it mkdir

More information

CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND

CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND Prof. Michael J. Reale Fall 2014 Finding Files in a Directory Tree Suppose you want to find a file with a certain filename (or with a filename matching

More information

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

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 Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing

More information

The Unix Shell. Pipes and Filters

The Unix Shell. Pipes and Filters The Unix Shell Copyright Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See http://software-carpentry.org/license.html for more information. shell shell pwd

More information

CST Algonquin College 2

CST Algonquin College 2 The Shell Kernel (briefly) Shell What happens when you hit [ENTER]? Output redirection and pipes Noclobber (not a typo) Shell prompts Aliases Filespecs History Displaying file contents CST8207 - Algonquin

More information

Introduction: What is Unix?

Introduction: What is Unix? Introduction Introduction: What is Unix? An operating system Developed at AT&T Bell Labs in the 1960 s Command Line Interpreter GUIs (Window systems) are now available Introduction: Unix vs. Linux Unix

More information

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute

The UNIX Shells. Computer Center, CS, NCTU. How shell works. Unix shells. Fetch command Analyze Execute Shells The UNIX Shells How shell works Fetch command Analyze Execute Unix shells Shell Originator System Name Prompt Bourne Shell S. R. Bourne /bin/sh $ Csh Bill Joy /bin/csh % Tcsh Ken Greer /bin/tcsh

More information

Introduction To. Barry Grant

Introduction To. Barry Grant Introduction To Barry Grant bjgrant@umich.edu http://thegrantlab.org Working with Unix How do we actually use Unix? Inspecting text files less - visualize a text file: use arrow keys page down/page up

More information

Chapter 9. Shell and Kernel

Chapter 9. Shell and Kernel Chapter 9 Linux Shell 1 Shell and Kernel Shell and desktop enviroment provide user interface 2 1 Shell Shell is a Unix term for the interactive user interface with an operating system A shell usually implies

More information

UNIX Basics. UNIX Basics CIS 218 Oakton Community College

UNIX Basics. UNIX Basics CIS 218 Oakton Community College UNIX Basics UNIX Basics CIS 218 Oakton Community College History UNIX was invented in 1969 at AT&T Bell Labs Ken Thompson and Dennis Ritchie are credited as the original architects and developers of C.

More information

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

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT Unix as a Platform Exercises Course Code: OS-01-UNXPLAT Working with Unix 1. Use the on-line manual page to determine the option for cat, which causes nonprintable characters to be displayed. Run the command

More information

Introduction to the Linux Command Line January Presentation Topics

Introduction to the Linux Command Line January Presentation Topics 1/22/13 Introduction to the Linux Command Line January 2013 Presented by Oralee Nudson ARSC User Consultant & Student Supervisor onudson@alaska.edu Presentation Topics Information Assurance and Security

More information

Shell Programming Systems Skills in C and Unix

Shell Programming Systems Skills in C and Unix Shell Programming 15-123 Systems Skills in C and Unix The Shell A command line interpreter that provides the interface to Unix OS. What Shell are we on? echo $SHELL Most unix systems have Bourne shell

More information

Introduction to Linux

Introduction to Linux Introduction to Linux January 2011 Don Bahls User Consultant (Group Leader) bahls@arsc.edu (907) 450-8674 Overview The shell Common Commands File System Organization Permissions Environment Variables I/O

More information

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

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University Unix/Linux Basics 1 Some basics to remember Everything is case sensitive Eg., you can have two different files of the same name but different case in the same folder Console-driven (same as terminal )

More information

LOG ON TO LINUX AND LOG OFF

LOG ON TO LINUX AND LOG OFF EXPNO:1A LOG ON TO LINUX AND LOG OFF AIM: To know how to logon to Linux and logoff. PROCEDURE: Logon: To logon to the Linux system, we have to enter the correct username and password details, when asked,

More information

Part 1: Basic Commands/U3li3es

Part 1: Basic Commands/U3li3es Final Exam Part 1: Basic Commands/U3li3es May 17 th 3:00~4:00pm S-3-143 Same types of questions as in mid-term 1 2 ls, cat, echo ls -l e.g., regular file or directory, permissions, file size ls -a cat

More information

Useful Unix Commands Cheat Sheet

Useful Unix Commands Cheat Sheet Useful Unix Commands Cheat Sheet The Chinese University of Hong Kong SIGSC Training (Fall 2016) FILE AND DIRECTORY pwd Return path to current directory. ls List directories and files here. ls dir List

More information

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

CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater) CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater) 28 January 2013 Jason Yosinski Original slides available under Creative Commons Attribution-ShareAlike 3.0

More information

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong Shell Prof. Jinkyu Jeong (Jinkyu@skku.edu) TA -- Minwoo Ahn (minwoo.ahn@csl.skku.edu) TA -- Donghyun Kim (donghyun.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

More information

INd_rasN SOME SHELL SCRIPTING PROGRAMS. 1. Write a shell script to check whether the name passed as first argument is the name of a file or directory.

INd_rasN SOME SHELL SCRIPTING PROGRAMS. 1. Write a shell script to check whether the name passed as first argument is the name of a file or directory. 1. Write a shell script to check whether the name passed as rst argument is the name of a le or directory. Ans: #!/bin/bash if [ -f $1 ] echo "$1 is a le" echo "$1 is not a le" 2. Write a shell script

More information

5/20/2007. Touring Essential Programs

5/20/2007. Touring Essential Programs Touring Essential Programs Employing fundamental utilities. Managing input and output. Using special characters in the command-line. Managing user environment. Surveying elements of a functioning system.

More information

Introduction to UNIX Part II

Introduction to UNIX Part II T H E U N I V E R S I T Y of T E X A S H E A L T H S C I E N C E C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S Introduction to UNIX Part II For students

More information

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples EECS2301 Title Unix/Linux Introduction These slides are based on slides by Prof. Wolfgang Stuerzlinger at York University Warning: These notes are not complete, it is a Skelton that will be modified/add-to

More information

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

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: Linux Tutorial How to read the examples When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: $ application file.txt

More information

find starting-directory -name filename -user username

find starting-directory -name filename -user username Lab 7: Input and Output The goal of this lab is to gain proficiency in using I/O redirection to perform tasks on the system. You will combine commands you have learned in this course using shell redirection,

More information

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi

sottotitolo A.A. 2016/17 Federico Reghenzani, Alessandro Barenghi Titolo presentazione Piattaforme Software per la Rete sottotitolo BASH Scripting Milano, XX mese 20XX A.A. 2016/17, Alessandro Barenghi Outline 1) Introduction to BASH 2) Helper commands 3) Control Flow

More information

Lec 1 add-on: Linux Intro

Lec 1 add-on: Linux Intro Lec 1 add-on: Linux Intro Readings: - Unix Power Tools, Powers et al., O Reilly - Linux in a Nutshell, Siever et al., O Reilly Summary: - Linux File System - Users and Groups - Shell - Text Editors - Misc

More information

CS 25200: Systems Programming. Lecture 11: *nix Commands and Shell Internals

CS 25200: Systems Programming. Lecture 11: *nix Commands and Shell Internals CS 25200: Systems Programming Lecture 11: *nix Commands and Shell Internals Dr. Jef Turkstra 2018 Dr. Jeffrey A. Turkstra 1 Lecture 11 Shell commands Basic shell internals 2018 Dr. Jeffrey A. Turkstra

More information

5/8/2012. Exploring Utilities Chapter 5

5/8/2012. Exploring Utilities Chapter 5 Exploring Utilities Chapter 5 Examining the contents of files. Working with the cut and paste feature. Formatting output with the column utility. Searching for lines containing a target string with grep.

More information

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms:

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms: Processes The Operating System, Shells, and Python Shell Commands a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms: - Command prompt - Shell - CLI Shell commands

More information

Lecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions?

Lecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions? Lecture 4 Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions? Tuesday, September 7 CS 375 UNIX System Programming - Lecture

More information

BGGN 213 Working with UNIX Barry Grant

BGGN 213 Working with UNIX Barry Grant BGGN 213 Working with UNIX Barry Grant http://thegrantlab.org/bggn213 Recap From Last Time: Motivation: Why we use UNIX for bioinformatics. Modularity, Programmability, Infrastructure, Reliability and

More information

Basic Linux (Bash) Commands

Basic Linux (Bash) Commands Basic Linux (Bash) Commands Hint: Run commands in the emacs shell (emacs -nw, then M-x shell) instead of the terminal. It eases searching for and revising commands and navigating and copying-and-pasting

More information

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018 EECS 470 Lab 5 Linux Shell Scripting Department of Electrical Engineering and Computer Science College of Engineering University of Michigan Friday, 1 st February, 2018 (University of Michigan) Lab 5:

More information

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

Linux at the Command Line Don Johnson of BU IS&T Linux at the Command Line Don Johnson of BU IS&T We ll start with a sign in sheet. We ll end with a class evaluation. We ll cover as much as we can in the time allowed; if we don t cover everything, you

More information

Introduction to UNIX Shell Exercises

Introduction to UNIX Shell Exercises Introduction to UNIX Shell Exercises Determining Your Shell Open a new window or use an existing window for this exercise. Observe your shell prompt - is it a $ or %? What does this tell you? Find out

More information

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSC209H Lecture 1. Dan Zingaro. January 7, 2015 CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,

More information

CSCI 2132 Software Development. Lecture 5: File Permissions

CSCI 2132 Software Development. Lecture 5: File Permissions CSCI 2132 Software Development Lecture 5: File Permissions Instructor: Vlado Keselj Faculty of Computer Science Dalhousie University 14-Sep-2018 (5) CSCI 2132 1 Files and Directories Pathnames Previous

More information

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

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo UNIX COMMANDS AND SHELLS UNIX Programming 2015 Fall by Euiseong Seo What is a Shell? A system program that allows a user to execute Shell functions (internal commands) Other programs (external commands)

More information

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.

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. 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. 2 Conventions Used in This Book p. 2 Introduction to UNIX p. 5 An Overview

More information

Linux Refresher (1) 310/ Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006)

Linux Refresher (1) 310/ Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006) 310/1779-4 Fourth Workshop on Distributed Laboratory Instrumentation Systems (30 October - 24 November 2006) Linux Refresher (1) Razaq Babalola IJADUOLA These lecture notes are intended only for distribution

More information

Introduction to the UNIX command line

Introduction to the UNIX command line Introduction to the UNIX command line Steven Abreu Introduction to Computer Science (ICS) Tutorial Jacobs University s.abreu@jacobs-university.de September 19, 2017 Overview What is UNIX? UNIX Shell Commands

More information

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

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT Unix as a Platform Exercises + Solutions Course Code: OS 01 UNXPLAT Working with Unix Most if not all of these will require some investigation in the man pages. That's the idea, to get them used to looking

More information

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell:

Shells. A shell is a command line interpreter that is the interface between the user and the OS. The shell: Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed performs the actions Example:

More information

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze EECS 2031 Software Tools Prof. Mokhtar Aboelaze Footer Text 1 EECS 2031E Instructor: Mokhtar Aboelaze Room 2026 CSEB lastname@cse.yorku.ca x40607 Office hours TTH 12:00-3:00 or by appointment 1 Grading

More information

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

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29 UNIX The Very 10 Short Howto for beginners Soon-Hyung Yook March 27, 2015 Soon-Hyung Yook UNIX March 27, 2015 1 / 29 Table of Contents 1 History of Unix 2 What is UNIX? 3 What is Linux? 4 How does Unix

More information

Perl and R Scripting for Biologists

Perl and R Scripting for Biologists Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications

More information

1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words

1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words More Linux Commands 1 wc The Linux command for acquiring size statistics on a file is wc. This command provides the line count, word count and number of bytes in a file. Open up a terminal, make sure you

More information

Week Overview. Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file

Week Overview. Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file ULI101 Week 05 Week Overview Simple filter commands: head, tail, cut, sort, tr, wc grep utility stdin, stdout, stderr Redirection and piping /dev/null file head and tail commands These commands display

More information

Recap From Last Time:

Recap From Last Time: Recap From Last Time: BGGN 213 Working with UNIX Barry Grant http://thegrantlab.org/bggn213 Motivation: Why we use UNIX for bioinformatics. Modularity, Programmability, Infrastructure, Reliability and

More information

Module 8 Pipes, Redirection and REGEX

Module 8 Pipes, Redirection and REGEX Module 8 Pipes, Redirection and REGEX Exam Objective 3.2 Searching and Extracting Data from Files Objective Summary Piping and redirection Partial POSIX Command Line and Redirection Command Line Pipes

More information

Basics. I think that the later is better.

Basics.  I think that the later is better. Basics Before we take up shell scripting, let s review some of the basic features and syntax of the shell, specifically the major shells in the sh lineage. Command Editing If you like vi, put your shell

More information

Week 2 Lecture 3. Unix

Week 2 Lecture 3. Unix Lecture 3 Unix Terminal and Shell 2 Terminal Prompt Command Argument Result 3 Shell Intro A system program that allows a user to execute: shell functions (e.g., ls -la) other programs (e.g., eclipse) shell

More information

Linux & Shell Programming 2014

Linux & Shell Programming 2014 Practical No : 1 Enrollment No: Group : A Practical Problem Write a date command to display date in following format: (Consider current date as 4 th January 2014) 1. dd/mm/yy hh:mm:ss 2. Today's date is:

More information

CS 246 Winter Tutorial 2

CS 246 Winter Tutorial 2 CS 246 Winter 2016 - Tutorial 2 Detailed Version January 14, 2016 1 Summary git Stuff File Properties Regular Expressions Output Redirection Piping Commands Basic Scripting Persistent Data Password-less

More information

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

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2 CSE Linux VM For Microsoft Windows Based on opensuse Leap 42.2 Dr. K. M. Flurchick February 2, 2017 Contents 1 Introduction 1 2 Requirements 1 3 Procedure 1 4 Usage 3 4.1 Start/Stop.................................................

More information

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

M2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE M2PGER 2013-2014 FORTRAN programming General introduction Virginie DURAND and Jean VIRIEUX 1 Why learning programming??? 2 Why learning programming??? ACQUISITION numerical Recording on magnetic supports

More information

Introduction to Shell Scripting

Introduction to Shell Scripting Introduction to Shell Scripting Evan Bollig and Geoffrey Womeldorff Presenter Yusong Liu Before we begin... Everyone please visit this page for example scripts and grab a crib sheet from the front http://www.scs.fsu.edu/~bollig/techseries

More information

Practical 02. Bash & shell scripting

Practical 02. Bash & shell scripting Practical 02 Bash & shell scripting 1 imac lab login: maclab password: 10khem 1.use the Finder to visually browse the file system (single click opens) 2.find the /Applications folder 3.open the Utilities

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming 1 Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed

More information

Answers to AWK problems. Shell-Programming. Future: Using loops to automate tasks. Download and Install: Python (Windows only.) R

Answers to AWK problems. Shell-Programming. Future: Using loops to automate tasks. Download and Install: Python (Windows only.) R Today s Class Answers to AWK problems Shell-Programming Using loops to automate tasks Future: Download and Install: Python (Windows only.) R Awk basics From the command line: $ awk '$1>20' filename Command

More information

Assignment clarifications

Assignment clarifications Assignment clarifications How many errors to print? at most 1 per token. Interpretation of white space in { } treat as a valid extension, involving white space characters. Assignment FAQs have been updated.

More information

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems. Copyleft 2005, Binnur Kurt 3 Operating Systems Copyleft 2005, Binnur Kurt Content The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail.

More information

Linux Command Line Interface. December 27, 2017

Linux Command Line Interface. December 27, 2017 Linux Command Line Interface December 27, 2017 Foreword It is supposed to be a refresher (?!) If you are familiar with UNIX/Linux/MacOS X CLI, this is going to be boring... I will not talk about editors

More information

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

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen Introduction to Unix The Windows User perspective Wes Frisby Kyle Horne Todd Johansen What is Unix? Portable, multi-tasking, and multi-user operating system Software development environment Hardware independent

More information

The Unix Shell & Shell Scripts

The Unix Shell & Shell Scripts The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises

More information

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

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing Content 3 Operating Systems The concept of an operating system. The internal architecture of an operating system. The architecture of the Linux operating system in more detail. How to log into (and out

More information

CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 2

CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 2 CS 307: UNIX PROGRAMMING ENVIRONMENT REVIEW FOR EXAM 2 Prof. Michael J. Reale Fall 2014 EXAM 2 OVERVIEW Exam 2 Material Exam 2 will cover the following: REVIEW slides from (8) to (17) (INCLUSIVE) THIS

More information

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala Basic UNIX commands HORT 59000 Lab 2 Instructor: Kranthi Varala Client/Server architecture User1 User2 User3 Server (UNIX/ Web/ Database etc..) User4 High Performance Compute (HPC) cluster User1 Compute

More information

Unix Handouts. Shantanu N Kulkarni

Unix Handouts. Shantanu N Kulkarni Unix Handouts Shantanu N Kulkarni Abstract These handouts are meant to be used as a study aid during my class. They are neither complete nor sincerely accurate. The idea is that the participants should

More information

Unix Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP

Unix Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP Unix Guide Meher Krishna Patel Created on : Octorber, 2017 Last updated : December, 2017 More documents are freely available at PythonDSP Table of contents Table of contents i 1 Unix commands 1 1.1 Unix

More information

Sub-Topic 1: Quoting. Topic 2: More Shell Skills. Sub-Topic 2: Shell Variables. Referring to Shell Variables: More

Sub-Topic 1: Quoting. Topic 2: More Shell Skills. Sub-Topic 2: Shell Variables. Referring to Shell Variables: More Topic 2: More Shell Skills Plan: about 3 lectures on this topic Sub-topics: 1 quoting 2 shell variables 3 sub-shells 4 simple shell scripts (no ifs or loops yet) 5 bash initialization files 6 I/O redirection

More information

Unix basics exercise MBV-INFX410

Unix basics exercise MBV-INFX410 Unix basics exercise MBV-INFX410 In order to start this exercise, you need to be logged in on a UNIX computer with a terminal window open on your computer. It is best if you are logged in on freebee.abel.uio.no.

More information

Review of Fundamentals

Review of Fundamentals Review of Fundamentals 1 The shell vi General shell review 2 http://teaching.idallen.com/cst8207/14f/notes/120_shell_basics.html The shell is a program that is executed for us automatically when we log

More information

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie Introduction in Unix Linus Torvalds Ken Thompson & Dennis Ritchie My name: John Donners John.Donners@surfsara.nl Consultant at SURFsara And Cedric Nugteren Cedric.Nugteren@surfsara.nl Consultant at SURFsara

More information

EECS2301. Lab 1 Winter 2016

EECS2301. Lab 1 Winter 2016 EECS2301 Lab 1 Winter 2016 Lab Objectives In this lab, you will be introduced to the Linux operating system. The basic commands will be presented in this lab. By the end of you alb, you will be asked to

More information

LAB 8 (Aug 4/5) Unix Utilities

LAB 8 (Aug 4/5) Unix Utilities Aug 4/5 Due: Aug 11 in class Name: CSE number: LAB 8 (Aug 4/5) Unix Utilities The purpose of this lab exercise is for you to get some hands-on experience on using some fundamental Unix utilities (commands).

More information

Basic Linux Command Line Interface Guide

Basic Linux Command Line Interface Guide This basic Linux Command-Line Interface (CLI) Guide provides a general explanation of commonly used Bash shell commands for the Barracuda NG Firewall. You can access the command-line interface by connecting

More information

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands Introduction to Unix: Fundamental Commands Ricky Patterson UVA Library Based on slides from Turgut Yilmaz Istanbul Teknik University 1 What We Will Learn The fundamental commands of the Unix operating

More information

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results.

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results. Volume: 230 Questions Question No: 1 You located a file created in /home successfully by using the slocate command. You found that the slocate command could locate that file even after deletion. What could

More information

Topic 2: More Shell Skills

Topic 2: More Shell Skills Topic 2: More Shell Skills Sub-topics: 1 quoting 2 shell variables 3 sub-shells 4 simple shell scripts (no ifs or loops yet) 5 bash initialization files 6 I/O redirection & pipes 7 aliases 8 text file

More information

Basic Linux Command Line Interface Guide

Basic Linux Command Line Interface Guide This basic Linux Command-Line Interface (CLI) Guide provides a general explanation of commonly used Bash shell commands for the Barracuda NG Firewall. You can access the command-line interface by connecting

More information

The input can also be taken from a file and similarly the output can be redirected to another file.

The input can also be taken from a file and similarly the output can be redirected to another file. Filter A filter is defined as a special program, which takes input from standard input device and sends output to standard output device. The input can also be taken from a file and similarly the output

More information

Introduction to Unix/Linux INX_S17, Day 8,

Introduction to Unix/Linux INX_S17, Day 8, Introduction to Unix/Linux INX_S17, Day 8, 2017-04-21 stdin, stdout, stderr, piping, iterative filtering, grep, cat, UUOC Learning Outcome(s): Redirect the standard output to the standard input stream

More information

Lab 2: Linux/Unix shell

Lab 2: Linux/Unix shell Lab 2: Linux/Unix shell Comp Sci 1585 Data Structures Lab: Tools for Computer Scientists Outline 1 2 3 4 5 6 7 What is a shell? What is a shell? login is a program that logs users in to a computer. When

More information

Log into Linux Reminders: Homework 1 due today; Homework 2 due on Thursday Questions?

Log into Linux Reminders: Homework 1 due today; Homework 2 due on Thursday Questions? Lecture 4 Log into Linux Reminders: Homework 1 due today; Homework 2 due on Thursday Questions? Tuesday, September 8 CS 375 UNIX System Programming - Lecture 4 1 Outline Exercise from last lecture More

More information

Chapter 1 - Introduction. September 8, 2016

Chapter 1 - Introduction. September 8, 2016 Chapter 1 - Introduction September 8, 2016 Introduction Overview of Linux/Unix Shells Commands: built-in, aliases, program invocations, alternation and iteration Finding more information: man, info Help

More information

Introduction to Linux Workshop 1

Introduction to Linux Workshop 1 Introduction to Linux Workshop 1 The George Washington University SEAS Computing Facility Created by Jason Hurlburt, Hadi Mohammadi, Marco Suarez hurlburj@gwu.edu Logging In The lab computers will authenticate

More information

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

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester Linux Essentials Programming and Data Structures Lab M Tech CS First Year, First Semester Adapted from PDS Lab 2014 and 2015 Login, Logout, Password $ ssh mtc16xx@192.168.---.--- $ ssh X mtc16xx@192.168.---.---

More information

bash, part 3 Chris GauthierDickey

bash, part 3 Chris GauthierDickey bash, part 3 Chris GauthierDickey More redirection As you know, by default we have 3 standard streams: input, output, error How do we redirect more than one stream? This requires an introduction to file

More information

Advanced Linux Commands & Shell Scripting

Advanced Linux Commands & Shell Scripting Advanced Linux Commands & Shell Scripting Advanced Genomics & Bioinformatics Workshop James Oguya Nairobi, Kenya August, 2016 Man pages Most Linux commands are shipped with their reference manuals To view

More information

Unix Introduction to UNIX

Unix Introduction to UNIX Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various

More information

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

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University Lecture 8 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control 22-Sep-2017 Location: Goldberg CS 127 Time: 14:35 15:25 Instructor:

More information

Environment Variables

Environment Variables Environment Variables > the shell has variables: my_var="some_value" > no space allowed around "=" echo $my_var > dereferencing by prepending a "$" > more generally: ${my_var} > shell variables can be

More information

Shells and Shell Programming

Shells and Shell Programming Shells and Shell Programming Shells A shell is a command line interpreter that is the interface between the user and the OS. The shell: analyzes each command determines what actions are to be performed

More information

Welcome to Linux. Lecture 1.1

Welcome to Linux. Lecture 1.1 Welcome to Linux Lecture 1.1 Some history 1969 - the Unix operating system by Ken Thompson and Dennis Ritchie Unix became widely adopted by academics and businesses 1977 - the Berkeley Software Distribution

More information

d. Permissions 600 on directory dir and 300 on file dir/foo. c. Permissions 700 on directory dir and 200 on file dir/foo.

d. Permissions 600 on directory dir and 300 on file dir/foo. c. Permissions 700 on directory dir and 200 on file dir/foo. Ian! D. Allen Winter 2012-1- 45 minutes Test Version: Print Name: Multiple Choice - 42 Questions - 25 of 25% 1. Read all the instructions and both sides (back and front) of all pages. 2. Put the Test Version

More information

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

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description: BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description: This course provides Bioinformatics students with the

More information

CS395T: Introduction to Scientific and Technical Computing

CS395T: Introduction to Scientific and Technical Computing CS395T: Introduction to Scientific and Technical Computing Instructors: Dr. Karl W. Schulz, Research Associate, TACC Dr. Bill Barth, Research Associate, TACC Outline Continue with Unix overview File attributes

More information