CIS 191 Linux and Unix Skills

Slides:



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

NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
1 CSE 390a Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Josh Goodwin
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Linux Commands LINUX COMMANDS.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Welcome to CSE  Name: Di Cao   Classroom: DL357  Class Time: T 8:30am - 9:18am  Office.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
© Crown copyright Met Office An Introduction to Linux PRECIS Workshop, University of Reading, 23rd – 27th April 2012.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
POS/420 Introduction to Unix Philip Robbins – March 12, 2013 (Week 1)
CENT 305 Information Systems Security Linux Introduction.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
UNIX/LINUX SHELLS.  “A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Unix/Linux for beginners:
1 CSE 390a Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson
Intro to UNIX Presented by: Student Ambassadors: Lauren Lewis Martin Sung.
1 CSE 390a Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson
Introduction to Programming Using C An Introduction to Operating Systems.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
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.
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
UNIX  Portable (common to many computer architectures), multitasking, multi-user operating system  Introduced by Bell labs in mid-1960’s  Thus, much.
By Jonathan Rinfret UNIX/LINUX By Jonathan Rinfret
Overview of Linux Fall 2016 Dr. Donghyun Kim
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.
EE516: Embedded Software Project 1
Quality Thought Technologies
IT244 - Introduction to Linux / Unix Instructor: Bo Sheng
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Introduction to Unix May 24, 2008 Rabat, Morocco Hervey Allen
Some Linux Commands.
introduction to Linux/Unix environment
Introduction to Linux Dr Karina Kubiak - Ossowska
Lecture #3 Modern OS characteristics
Software Tools Recitation 1
The Linux Operating System
UNIX & LINUX Operating Systems
Assignment Preliminaries
introduction to Linux/Unix environment
Chapter 1 The Essence of UNIX and Linux
Introduction to UNIX.
Lecture #3 Modern OS characteristics
CSE 390a Lecture 1 introduction to Linux/Unix environment
Unix : Introduction and Commands
CSE 390a Lecture 1 introduction to Linux/Unix environment
introduction to Linux/Unix environment
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Lecture 5: UNIX & LINUX Operating Systems
introduction to Linux/Unix environment
Linux Professor Sabol.
Yung-Hsiang Lu Purdue University
introduction to Linux/Unix environment
Module 6 Working with Files and Directories
introduction to Linux/Unix environment
introduction to Linux/Unix environment
Lab 2: Terminal Basics.
introduction to Linux/Unix environment
Linux Commands LINUX COMMANDS.
Presentation transcript:

CIS 191 Linux and Unix Skills Lecture 1

Lecture Plan Introduction and Logistics. Unix/Linux Overview. Navigating the Filesystem.

Introduction and Logistics

About Me Instructor: Solomon Maina Email: smaina@seas.upenn.edu Office Hours : Wednesdays 4:00-6:00 Location : Levine 057

Why Take CIS 191? Learn how to use the Unix OS using the Command Line. Learn how to write shell scripts. Learn some important tools and skills for programming.

What are Scripts? A script is a small program used to automate the execution of tasks e.g. create this directory then compile this program then delete this file etc...

Shell Script Example The script below renames filenames of the form 24-09-2007-picturename.jpg to 2007-09-24-picturename.jpg for fn in *.jpg do mv $fn ‘echo $fn |\ sed ‘s/([0-9]+)-([0-9]+)-([0-9]+)/\3-\2-\1/’‘ done

Workload Lectures once a week. Five assignments, roughly one every two weeks. Final project.

Resources Course website: https://www.cis.upenn.edu/~cis191/ Piazza: https://www.piazza.com/upenn/fall2019/c is191 Canvas: https://canvas.upenn.edu/

Unix/Linux Overview

What is Unix? Unix is a widely influential operating system developed in the 70s. Unix was written in C instead of assembly, making it the first portable OS. Unix helped set the standard for multi-tasking, multi-user systems. Unix was proprietary!

GNU: GNU’s Not Unix! Richard Stallman started the GNU project in 1983. Goal: create a free complete Unix-compatible software system (free as in the users have the freedom to run, copy, distribute, study, change and improve the software) . Largely achieved this goal by the early 1990s except for some low-level elements such as the kernel.

Linux Linus Torvalds wrote a kernel (with others) in 1991. Kernel adopted by the GNU system in 1992. GNU/Linux system now just called “Linux”.

Linux Distros Linux comes in hundreds of flavors called “distributions” or distros. Distros generally have different design goals (security, speed, desktop use, etc). Examples are Ubuntu, Mint, Debian, Fedora, Red Hat, openSUSE etc…

Unix Flavours There currently exist many operating systems based on Unix, or Unix flavours e.g. Berkeley Software Distribution (BSD) GNU/Linux Mac OS X Sun’s Solaris IBM AIX, HP-UX, Silicon Graphics IRIX, etc… For CIS 191, we will focus on GNU/Linux.

SUS and POSIX The Single UNIX Specification (SUS) is the collective name of a family of standards for computer operating systems, compliance with which is required to qualify for using the “UNIX” trademark. The SUS emerged from a mid-1980s project to standardize operating system interfaces for software designed for variants of the Unix operating system. In 1988, these standards became POSIX, which loosely stands for Portable Operating System Interface. Some Unix flavours are POSIX-certified (e.g. Mac OS X) while others are not (e.g. Linux).

Shells Unix flavours allow the user to interact with the OS through command line interpreters, or shells. There are many shells: sh – Bourne shell (Unix) bash – Bourne Again shell (GNU/Linux) csh – C shell (BSD Unix) ash, dash, ksh, zsh, tcsh, fish etc… For CIS 191, we will focus on bash.

Command Line Basics To execute a command or use a tool, type its name into the shell and press return/enter. Commands are of the form, SomeCommand [-opt] [target] … for example turnin –c cis191 –p hw0 file.txt

Flags/Options Most commands take flags/options that usually com before any targets and begin with a dash. Some common options are -h, --help : Give a usage message and exit -v, --version : Show program version and exit -a, --all : Show all information or operate on all arguments -l, --list : List files or arguments without taking other action -o : Output filename -r, -R, --recursive : Operate recursively (down directory tree) -q, --quiet : Suppress stdout -v, --verbose : Output additional information to stdout or stderr -z, --compress : Apply compression Options that do not take arguments can be usually be ganged together, e.g. ls –a –l = ls -al.

Getting Unix/Linux Dual boot i.e. run your OS and Unix/Linux side by side but not at the same time. Install a virtual machine (recommended). Install Windows Subsystem for Linux (WSL) on Windows. Download Cygwin on Windows. For CIS 191, you *MAY* get by using Mac OS X on Mac, Cygwin on Windows, or any other Unix flavor.

Navigating the Filesystem

Navigating the Filesystem ls [OPTION]… [FILE]… List information about the FILEs (the current directory by default) -a : do not ignore entries starting with a . (hidden files). -l : use a long listing format.

Navigating Directories pwd [OPTION]… Print name of current/working directory. cd [OPTION]… [DIRECTORY] Change the working directory. mkdir [OPTION]… [DIRECTORY]… Make the DIRECTORY(ies), if they do not already exist. rmdir [OPTION]… DIRECTORY… Remove the DIRECTOR(ies), if they are empty.

The Directory Stack The directory stack is a list of recently-visited directories. The pushd command adds directories to the stack as it changes the current directory. The popd command removes specified directories from the stack and changes the current directory to the directory removed. The current directory is always at the “top” of the stack. The dirs command displays the contents of the directory stack.

The Directory Stack dirs [-clpv] [+N | -N] Display the list of currently remembered directories. -c : Clears the directory stack by deleting all of the elements. -l : Produces a listing using full pathnames; the default listing format uses a tilde to denote the home directory. -p : Causes dirs to print the directory stack with one entry per line. -v : Causes dirs to print the directory stack with one entry per line, prefixing each entry with its index in the stack. +N : Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero. -N : Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.

., .., ~ On Unix-like operating systems, every directory contains an object represented by a single dot and another represented by two successive dots. The former refers to the directory itself and the latter refers to its parent directory (i.e., the directory that contains it). In most shells, tilde (~) expands to the value of the home directory of the current user. ~user expands to the value of the home directory of the user named user. ~+N expands to the string that would be displayed by ‘dirs +N’. ~-N expands to the string that would be displayed by ‘dirs -N’.

Creating and Viewing Files touch [OPTION]… FILE… Update the access and modification times of each FILE to the current time. A FILE argument that does not exist is created. cat [OPTION]… FILE Concatenate FILE(s) to standard output With no FILE, or when FILE is -, read standard input.

Viewing Files more [OPTION]… FILE… A filter for paging through text one screenful at a time. SPACE, z or RETURN to display next page, d to scroll forward. b to display previous page, but no way to scroll backward. q to quit less [OPTION]… FILE Same as more but lets you scroll backwards. Does not have to read the entire input file before starting, hence is faster with large files.

Viewing Files head [OPTION]… FILE… Print the first 10 lines of each file to standard output. -n NUM: Print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines of each file. With no FILE, or when file is -, read standard input. tail [OPTION]… FILE Print the last 10 lines of each file to standard output.

Navigating the Filesystem rm [OPTION]… [FILE]… Remove files or directories -r, -R, --recursive : removes directories and their contents recursively. -i : prompts the user whether to proceed with the entire operation if there are more than three files or -r, -R, --recursive are given.

Navigating the Filesystem cp [OPTION]… SOURCE DEST Copy SOURCE to DEST. mv [OPTION]… SOURCE DEST mv [OPTION]… SOURCE DIRECTORY Rename SOURCE to DEST, or move SOURCE(s) to directory.