Introduction to Linux

Similar documents
Introduction to Linux

Introduction to Linux

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

Introduction to Unix. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

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

Introduction of Linux

Perl and R Scripting for Biologists

Overview of Unix / Linux operating systems

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

Introduction to Cygwin Operating Environment

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

Operating Systems. Copyleft 2005, Binnur Kurt

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

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

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

Lecture 01: welcome and intro what LSD and Unix have in common

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

CISC 220 fall 2011, set 1: Linux basics

Systems Programming. The Unix/Linux Operating System

Unix System Architecture, File System, and Shell Commands

Introduction: What is Unix?

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

Lecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world.

UNIX Kernel. UNIX History

Computer Systems and Architecture

Introduction to Linux. Fundamentals of Computer Science

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

System Programming. Introduction to Unix

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Unix Filesystem. January 26 th, 2004 Class Meeting 2

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

GNU/Linux Course Lesson 1. Puria Nafisi

Introduction to Operating Systems

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

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

INF322 Operating Systems

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

Operating System Labs. Yuanbin Wu

CS246 Spring14 Programming Paradigm Notes on Linux

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Chap2: Operating-System Structures

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Introduction to Unix: Fundamental Commands

Introduction. Let s start with the first set of slides

Introduction to Supercomputing

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

Welcome to Linux. Lecture 1.1

Linux & Shell Programming 2014

The Unix Shell & Shell Scripts

Introduction to Linux Basics

Computer Systems and Architecture

CSE 390a Lecture 1. introduction to Linux/Unix environment

CENG393 Computer Networks Labwork 1

Introduction to the basics of UNIX

CS 300. Data Structures

Session 1: Accessing MUGrid and Command Line Basics

The Unix Family. Linux 101. GNU/Linux distributions. Even more. MULTICS MIT/GE/Bell Labs. UNIX AT&T (Bell Labs) Mach, Carnegie Mellon

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

(a) About Unix. History

CSE 391 Lecture 1. introduction to Linux/Unix environment

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

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Chapter-3. Introduction to Unix: Fundamental Commands

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

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Unix Handouts. Shantanu N Kulkarni

Saint Louis University. Intro to Linux and C. CSCI 2400/ ECE 3217: Computer Architecture. Instructors: David Ferry

Linux Essentials Objectives Topics:

CS 300 Data Structures

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

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

Parallel Programming Pre-Assignment. Setting up the Software Environment

Linux Shell Script. J. K. Mandal

Exercise 1: Basic Tools

5/8/2012. Creating and Changing Directories Chapter 7

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Files

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

commandname flags arguments

Lecture P3: Unix. Overview. Operating Systems. Layers of Abstractions in Unix. Background

EECS2301. Lab 1 Winter 2016

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

Linux Session Part I. Kesavan M

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

Operating System Labs. Yuanbin Wu

Linux Systems Administration Getting Started with Linux

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

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

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

Operating Systems CS3502 Spring 2018

Using Commands. Introduction to Unix. May 24, 2008 Rabat, Morocco. Hervey Allen

Introduction of Linux. Huang Cheng-Chao Dept. of Comput. Sci. & Tech. East China Normal University

INTRODUCTION TO OPERATING SYSTEMS. Jo, Heeseung

COPYRIGHTED MATERIAL. Unix Fundamentals. Brief History

Lec 1 add-on: Linux Intro

Scripting Languages Course 1. Diana Trandabăț

CSc33200: Operating Systems, CS-CCNY, Fall 2003 Jinzhong Niu September 26, Nachos Overview

INTRODUCTION TO LINUX

CSE 391 Lecture 1. introduction to Linux/Unix environment

Transcription:

Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA Sanghoon Han(sanghoon.han@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

Announcement (1) Please come to 400212 We will only use this room You need to install Linux You can install VirtualBox (http://csl.skku.edu/uploads/sse2033s17/sse2033-0.pdf) Or you can use this room 2

Announcement (2) Please join http://sys.skku.edu You will be able to use this next week It will notify your project score (From Project 1 ) 3

What is OS? (1) Application side Provides the program execution environment Hides the messy details which must be performed Make machine easy to use Provides an abstract view of the underlying system Processors -> Processes, Threads Memory -> Virtual memory I/O devices -> Files 4

What is OS? (2) System side OS is a resource manager Sharing Protection Fairness Performance What is resource? Hardware» CPU, Memory, I/O devices Software» Queues, Miscellaneous» Energy, Power, 5

Unix (1) History and motivation Originally developed at AT&T Bell Labs for internal use in the early 1970s Borrowed best ideas from other OS s Unix is designed so that users can extend the functionality to build new tools easily and efficiently Why Unix? Used in many scientific and industrial settings Huge number of free and well-written software programs Many important OS concepts are developed on Unix. 6

Unix (2) Unix is Interactive Time-sharing Multi-tasking Multi-user Flavors of Unix System V (AT&T->USL->Novell->SCO->Caldera->SCO) BSD (UC Berkeley) SunOS, Solaris (Sun) IRIX (SGI), AIX (IBM), HP-UX (HP), Mac OS X (Apple) Linux, FreeBSD, NetBSD, and etc.. 7

Linux Open-source development began in 1991 First released by Linus Torvalds Linux kernel The core of Linux system Thousands of contributors Supervised by Linus and other maintainers Distribution A collection of software based around Linux kernel Red Hat, Fedora, Debian, Ubuntu, Android, 8

OS Internals (1) 9

OS Internals (2) A software between applications and hardware Highly-concurrent Event-driven What kind of events? System calls Interrupts 10

User Interfaces The space where we interact with machines Command-line interface (CLI) Command interpreter Difficult to learn Called as shell Graphical user interface (GUI) KDE, Gnome, Unity, Xfce, Touch user interface Smartphones, tablets 11

Shell (1) Executing programs on a shell $ command [options] [arguments] [$ ls] and [$ ls al] show different results All commands, options, arguments are case-sensitive Shells execute commands by means of processes An instance of a program in execution 12

Shell (2) A shell allows three types of commands An internal shell command (built-in command) An executable file that contains object code An executable file that contains a sequence of shell command lines (shell script) There are two families of shells One based on Bourne shell (sh) We will use Bourne again shell (bash) for the course The other based on C shell (csh) 13

File System Overview (1) A Unix file is a sequence of bytes Collection of related information defined by its creator Unstructured sequence of bytes File system Consist of two distinct parts: A collection of files A directory structure It provides the mechanism for on-line storage and access to file contents 14

File System Overview (2) Features of Unix file system A hierarchical structure It allows dynamic growth of files The ability to create and delete files The protection of the file data Unix treats the peripheral devices as files Everything is a file in Unix Documents, directories, hard-drives, network sockets, keyboards, printers are stream of bytes exposed through the file system namespace 15

File System Overview (3) Hierarchical, tree-like structure Root Non-leaf nodes Directories Leaf nodes Directories Regular files or special device files 16

File System Overview (4) *http://www.linuxplanet.com/linuxplanet/tutorials/6666/1 17

File System Overview (5) Root directory ["/"] The top-most directory in a hierarchy Home directory ["~"] A special directory for a user It contain the user s files; including texts, musics, videos, or configuration files (Current) Working directory Each process has associated with it a directory The directory where a user currently located 18

File System Overview (6) /bin Contains certain fundamental utilities /dev Essential devices /etc Host-specific system-wide configuration files /tmp A place for temporary files /var A place for files that may change often 19

Path The general form of the name of a file or a directory Delimiting characters ["/"] Represent each directory in path expressed in string Absolute path (full path) A path points a location regardless of present working directory $ cat /home/sanghoon/textfile $ cat ~/textfile Relative path A path relative to the working directory of the user $ cat textfile [if cwd is "/home/sanghoon"] 20

File Permission Every files have a set of permissions Ownership User/owner The person who owns/created the file. Group Unix allows for the creation of groups Others Everyone else in the world that has access to that computer Permission for Access Read (4) Write (2) execute (1) 21

Exercise

Contents Basic commands Basic C coding Basic File I/O 23

Basic commands (1) man Display the manual page Display a manual of a program or a function $ man qsort $ man man (manual for manual page) 24

Basic commands (2) ls List files $ ls $ ls -al /etc $ ll ps List process $ ps $ ps ef $ man ps 25

Basic commands (3) pwd Print working directory cd Change working directory $ cd.. $ cd /proc $ cd ~ 26

Basic commands (4) echo Display a line of text $ echo "Hello?" printf Print a formatted line of text $ printf "%s\n" Hello? cat Displaying files $ cat /etc/issue more / less 27

Basic commands (5) mkdir / rmdir Make / remove a directory $ mkdir swex1 mv Move or rename files $ mv swex1/ swex2/ cp Copy files rm Remove files 28

Basic commands (6) date Print or set the system date and time grep Searching files for a specified expression $ grep [expression] [files] $ grep root /etc/passwd 29

Basic commands (7) chmod Change the permissions on a file or directory u user + to add a permission r(4) read g group - to remove a permission w(2) write o other = to assign a permission explicitly x(1) execute (for files), access (for directories) $ chmod u=rw file1 $ chmod u+x,g+w,o-r file2 $ ls l swex2/ $ chmod 750 swex2/ $ ls l swex2/ 30

Basic commands (8) diff [file1] [file2] Reports line-by-line differences between file1 and file2 31

Development tools vi[m] A text editor for programmers $ vim [file_name] Create (if not exist) or open a file 'file_name http://csl.skku.edu/sse2033s17/resources $ vim hello.c gcc GNU compiler collection $ gcc o hello hello.c $./hello 32

hello.c #include <stdio.h> int main(void) { printf("hello, world\n"); return 0; } 33

Exercise (1) Lab exercise #1: Make "sse" directory on your home directory Create hello.c on the directory Compile it Run the program Remove "sse" directory Lab exercise #2: With hello.c file, make shell script that run exercise #1 automatically. 34

Basic File I/O (1) Opening a file int fd = open( path, flags) Read a character from a file read(fd, &c, 1) Write a character to a file write(fd, &c, 1) Closing a file close(fd) 35

Exercise (2) Lab exercise #3: Let s make xcp utilities xcp copies conents of a file into a new file Basically, executing xcp will be same as executing cp without any options, respectively. Your job is to make xcp by using system calls provided by Linux. 36