Unix Shells and Other Basic Concepts

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

5/20/2007. Touring Essential Programs

Introduction: What is Unix?

CSCI 2132 Software Development. Lecture 4: Files and Directories

Part I. UNIX Workshop Series: Quick-Start

EECS2301. Lab 1 Winter 2016

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Linux Command Line Interface. December 27, 2017

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University

Unix. Examples: OS X and Ubuntu

System Programming. Unix Shells

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

Introduction to Linux. Fundamentals of Computer Science

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

Linux Systems Administration Getting Started with Linux

Introduction to the Shell

Files and Directories

Command-line interpreters

ACS Unix (Winter Term, ) Page 21

CS246 Spring14 Programming Paradigm Notes on Linux

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

Chapter 9. Shell and Kernel

Perl and R Scripting for Biologists

Introduction to Linux

User Guide Version 2.0

LAB #5 Intro to Linux and Python on ENGR

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

CSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science

CSCI2467: Systems Programming Concepts

Introduction to Linux

Mills HPC Tutorial Series. Linux Basics I

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

Unix Shell Environments. February 23rd, 2004 Class Meeting 6

The Online Unix Manual

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Shell Scripting. Winter 2019

Unix/Linux: History and Philosophy

What is UNIX? A Little Bit about UNIX and User Interfaces. Adapted from Practical Unix and Programming Hunter College

Introduction to Linux

Unix basics exercise MBV-INFX410

Linux Introduction Martin Dahlö Valentin Georgiev

Dalhousie University CSCI 2132 Software Development Winter 2018 Lab 2, January 25

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

Unzip command in unix

Wildcards and Regular Expressions

Introduction to UNIX I: Command Line 1 / 21

CS CS Tutorial 2 2 Winter 2018

CISC 220 fall 2011, set 1: Linux basics

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

Review of Fundamentals

Assignment 1. CSCI 2132: Software Development. Due Febuary 4, 2019

UNIX Kernel. UNIX History

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Lecture # 2 Introduction to UNIX (Part 2)

CptS 360 (System Programming) Unit 2: Introduction to UNIX and Linux

LINUX OS FUNDAMENTALS FOR THE SQL ADMIN

What is the Shell. Whenever you login to a Unix system you are placed in a program called the shell. All of your work is done within the shell.

Short Read Sequencing Analysis Workshop

Introduction to Linux

CS 261 Recitation 1 Compiling C on UNIX

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

Assignment clarifications

Introduction to UNIX Shell Exercises

Introduction To Linux

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

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

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

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

Lab 1 Introduction to UNIX and C

CS 246 Winter Tutorial 1

The Unix Shell & Shell Scripts

Chapter-3. Introduction to Unix: Fundamental Commands

COMP 4/6262: Programming UNIX

CSE 391 Lecture 1. introduction to Linux/Unix environment

C++ Programming on Linux

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Getting Started. Running Utilities. Shells. Special Characters. Special Characters. Chapter 2 Unix Utilities for non-programmers

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

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

Introduction to the Linux Command Line January Presentation Topics

Getting started with Hugs on Linux

Introduction to the Linux Command Line

Unix Workshop Aug 2014

Introduction to UNIX Part II

CSE 391 Lecture 1. introduction to Linux/Unix environment

Introduction to Linux Environment. Yun-Wen Chen

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

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Shell Programming Systems Skills in C and Unix

How to SSH to nice.fas.harvard.edu from Windows

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

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

Introduction to Linux for BlueBEAR. January

EE516: Embedded Software Project 1. Setting Up Environment for Projects

Getting started with Hugs on Linux

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

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

Introduction to Unix and Linux. Workshop 1: Directories and Files

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

Transcription:

CSCI 2132: Software Development Unix Shells and Other Basic Concepts Norbert Zeh Faculty of Computer Science Dalhousie University Winter 2019

Shells Shell = program used by the user to interact with the system Used to run programs on the system Built-in commands and utilities (external programs) Used to automate many tasks (can usually be scripted) UNIX has many shells: Bourne shell: sh, bash (Bourne-Again shell) Korn shell: ksh C shell: csh, tcsh Z shell: zsh (the Swiss army knife)

Getting Started with Unix (Lab) Mandatory exercise: Log in to bluenose using ssh Options: PuTTY, MobaXTerm (Windows) Terminal (Mac, Linux) Run Linux in a VirtualBox Main learning objective: Learn to open one or more terminals via ssh Ask TAs, use Learning Centre if necessary.

Logging in to Bluenose You can choose Mac/Windows machines in lab Windows: PuTTY Mac/Linux: Open a terminal, type ssh <your csid>@bluenose.cs.dal.ca Example: I d log in using nzeh@bluenose.cs.dal.ca

Shell Prompt Logging into bluenose starts a shell on bluenose The shell presents you with a prompt: <your csid>@bluenose:~$ This prompt may vary depending on the shell (Could be just $ or %) Prompt can be changed Run programs and shell commands by entering them after the prompt and pressing Edit command line before pressing

Running a Utility Enter a command (built-in or utility) A utility is a program the shell finds in the file system (E.g., in the /bin directory) Example: The following runs /bin/who $ who Example: $ date Tue Jan 8 10:00:01 ADT 2019 More examples: clear clears screen passwd changes your password

Command Line Arguments Many utilities take arguments Example: date takes an argument that influences the format of the output: $ date +%Y-%m-%d-%H-%M-%S 2018-01-08-10-00-33 Explore usage of date using $ man date (Use q to exit)

Manpages Manpages (manual pages) provide documentation about every command installed on a Unix system. Display manpage using man: Read about man: $ man man Find commands with keyword directory: $ man -k directory $ apropos directory Find the manpage for rmdir in Section 2 (Different sections for config files, system commands, user commands,...) $ man 2 rmdir

Special Shell Characters Some characters, when typed at the prompt are interpreted specially by the shell: ^C (Ctrl-C): End the current process ^Z (Ctrl-Z): Suspend the current process ^D (Ctrl-D): When entering input, signal the end of file ^L (Ctrl-L): Clear screen stty -a shows information about the terminal and the special characters it understands (man stty will help you decipher the output)

Standard Input/Output Channels Every Unix process has three standard files it can read from and write to: stdin (standard input): Normally the keyboard input of the program stdout (standard output): The normal output (to screen) of the program stderr (standard error): The channel error messages are sent to By default, stdout/stderr both go to the terminal. Without arguments, cat reads from its standard input and writes the read characters to its standard output.

$ cat > hamlet.txt To be or not to be that is the question ^D $ cat hamlet.txt To be or not be that is the question Example of cat

Editors We can create files using cat > filename, but that doesn t allow us to edit (modify) existing files. A text editor allows us to modify files. Standard UNIX editors: emacs (main editor used in this course) vi(m) (another major editor) pico, nano, others (easier to learn, much less powerful) Editors are covered in labs.

Logging Out On some shells, typing ^D is sufficient to log you out. This may be disabled because it s easy to type by accident, logging you out accidentally. logout and exit are commands you can invoke explicitly to log out.