Introduction to Linux

Similar documents
COURSE OUTLINE. UNIX Programming 2014 Fall by Euiseong Seo

a story of alternatives

Computer System Management - Unix/Linux

Operating System Labs. Yuanbin Wu

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

Perl and R Scripting for Biologists

Introduction to Linux Overview and Some History

CS246 Spring14 Programming Paradigm Notes on Linux

UNIX Kernel. UNIX History

Overview of Unix / Linux operating systems

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

UNIX Concepts COMPSCI 386

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

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

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

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

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

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

EECS2301. Lab 1 Winter 2016

The Unix Shell & Shell Scripts

Introduction to Linux

Operating System Labs. Yuanbin Wu

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

Unix Processes. What is a Process?

System Programming. Introduction to Unix

Welcome to Linux. Lecture 1.1

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

Introduction. Let s start with the first set of slides

Introduction to Linux

Introduction to Linux

Introduction to Linux

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

The UNIX Operating System. HORT Lecture 2 Instructor: Kranthi Varala

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

Files and Directories

INTRODUCTION TO LINUX

Unix to Linux. CS 3113 Fall 2018 Dr. Christan Grant

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

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

CISC 220 fall 2011, set 1: Linux basics

Introduction to Linux Basics

Introduc+on. General Information. General Information. General Information. General Information. General Information

Linux Kung-Fu. James Droste UBNetDef Fall 2016

CSCI 2132 Software Development. Lecture 4: Files and Directories

I/O and Shell Scripting

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

CS395T: Introduction to Scientific and Technical Computing

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

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

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

CSC209: Software Tools and Systems Programming. Richard Krueger Office hours: BA 3234

Mills HPC Tutorial Series. Linux Basics I

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

Introduction to Unix: Fundamental Commands

The landscape. File hierarchy overview. A tree structure of directories The directory tree is standardized. But varies slightly among distributions

CSC209. Software Tools and Systems Programming.

INF322 Operating Systems

Unix System Architecture, File System, and Shell Commands

Introduction to Linux

Unix/Linux: History and Philosophy

The Operating System Machine Level

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

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

CSE 391 Lecture 1. introduction to Linux/Unix environment

Chapter 1 - Introduction. September 8, 2016

CSC UNIX System, Spring 2015

Basic Unix. Set-up. Finding Terminal on the imac. Method 1. Biochemistry laboratories Jean-Yves Sgro

ScazLab. Linux Scripting. Core Skills That Every Roboticist Must Have. Alex Litoiu Thursday, November 14, 13

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

Introduction: What is Unix?

Basics of system administration on a Unix system

VIRTUAL FILE SYSTEM AND FILE SYSTEM CONCEPTS Operating Systems Design Euiseong Seo

18-Sep CSCI 2132 Software Development Lecture 6: Links and Inodes. Faculty of Computer Science, Dalhousie University. Lecture 6 p.

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

Introduction to Cygwin Operating Environment

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

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

CSE 391 Lecture 1. introduction to Linux/Unix environment

Introduction to Unix. University of Massachusetts Medical School. October, 2014

An Introduction to Unix Power Tools

Unix and C Program Development SEEM

(a) About Unix. History

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

PROGRAMMAZIONE I A.A. 2015/2016

CSC209. Software Tools and Systems Programming.

Linux Systems Administration Getting Started with Linux

The Operating System Machine Level

Practical 4. Linux Commands: Working with Directories

Protection. CSE473 - Spring Professor Jaeger. CSE473 Operating Systems - Spring Professor Jaeger

2. Features of UNIX OS Several features of UNIX have made it popular. Some of them are:

Introduction to the Shell

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

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

The UNIX Time- Sharing System

Week 5 Lesson 5 02/28/18

CS108 Software Systems: UNIX. Fall 2011

CPS221 Lecture: Operating System Functions

Creating a Shell or Command Interperter Program CSCI411 Lab

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: ~

Chapter-3. Introduction to Unix: Fundamental Commands

Transcription:

Introduction to

Operating Systems All computers that we interact with run an operating system

There are several popular operating systems Operating Systems

OS consists of a suite of basic software Operating Systems Compilers Text editors Shells Graphical interfaces Debuggers and much more And most importantly, the Kernel The OS Kernel is the chief software program that runs on a computer In the context of programming, OS usually refers to the kernel

Hardware Abstraction Operating Systems Function Resource Management Standardized Interface Security Performance

Hardware speaks binary A binary code can mean different things to different hardware Operating Systems Hardware Abstraction OS abstracts hardware The OS kernel is the layer separating hardware and applications Application software run in an environment where direct access to hardware is extremely limited Applications request the Kernel to perform hardware operations on its behalf Application Software Utilities Libraries Kernel Hardware

Resources are shared among applications Like CPUs, memory and input/output devices Operating Systems Kernel scheduler enables multitasking Allows more applications to run than there are CPUs Kernel provides memory protection Resource Management So that one application cannot disrupt others Mediates multiple device accesses Multiple programs communicating over the network for instance

System Calls Is how applications request the OS to perform a service on the application s behalf Operating Systems Standardized Interface Applications execute a special set of instructions on the CPU to invoke a system call Transfers control to the kernel to perform the function Applications resumes execution when function completes Standard Libraries Built on top of system calls to provide higher level functions Like buffered file I/O

Standardized System calls and Libraries Operating Systems Standardized Interface Documented names, parameters, return values and behavior of these functions Allow the programmer to tell the operating system to perform a function without need to consider The underlying hardware The OS implementation or version These standards constitute the Application Programming Interface (API) for an OS or family of OSes Applications that closely follow the standard API can be ported easily.

Operating Systems Security Access Control Enforce access restrictions on files among different users Network security Remote access control. Who can login remotely.

Operating Systems OS can use knowledge of underlying hardware and application behavior to enhance performance and efficiency Performance Transparent to the application Can use special features of the hardware to speed up operations Resource sharing between applications to maximize efficiency Cached access to filesystems is a good example

AT&T Unix Operating system developed in the 1970s at Bell Labs by a team led by Ken Thompson and Dennis Ritchie Operating Systems Unix GNU Project 1972, rewritten in C. A language originally developed by Dennis Ritchie at Bell Labs Unix was liberally licensed to universities and firms, including source code Led to its increased popularity in academia 1982, UNIX was commercialized. Source code was not included anymore Cover. Oct 20, 1982 issue Electronics

POSIX The official standard that defines Unix-like operating systems Operating Systems Unix GNU Project Large number of operating systems were derived from the original Unix Effort to standardize the Unix API to ease portability of software between different derivatives Eventually included commands, utilities and standard libraries Resulted in IEEE POSIX standard which evolved into the Single Unix Specification (SUS)

Operating Systems Unix GNU Project GNU Project A year after UNIX was commercialized, Richard Stallman announced a project to create a completely free UNIX-like OS By 1990, GNU was mostly complete except for a kernel

In 1991 Linus Torvalds starts a hobby project called Hello everybody out there using minix I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things). I've currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I'll get something practical within a few months, and I'd like to know what features most people would want. Any suggestions are welcome, but I won't promise I'll implement them :-) Linus (torvalds@kruuna.helsinki.fi) PS. Yes - it's free of any minix code, and it has a multi-threaded fs. It is NOT portable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that's all I have :-(. Linus Torvalds[14] GNU/ was born

Basics Users and Groups is a multi-user, multi-tasking OS All files managed by the OS are associated with a User and a Group Users and Groups are defined in a database which also defines a mapping with an integer user ID (uid) and group ID (gid) uid associated with a file is the owner of that file Special user root (uid 0) has unrestricted privileges Can access/modify all files Can change settings that can affect the operation of the system

Basics Process Programs are executable code stored on disk Processes are programs that are being executed by the OS Kernel assigns an integer process id (pid) to each process and keeps track of it Process can be in multiple states between start and termination Running Stopped Sleeping

Basics Files A file is anything that can be located by a unique pathname Processes can open files For a process, opening a file creates a new File Descriptor Subsequent read/write operations can be performed on the file descriptors Files may or may not have data stored on some media Unix abstracts devices as files Three file descriptors are automatically created when a process starts fd 0: standard input (stdin) fd 1: standard output (stdout) fd 2: standard error (stderr) These standard streams can be redirected to files

/ Directory Tree Basics Navigating the Filesystem All files exist within a directory (Folder in Windows) Hierarchical directory structure rooted at / Pathname specifies the location of a file or directory within the hierarchy / is the pathname directory separator home user1 ebasheer thesis.txt info.txt bin sbin mnt /home/ebasheer/thesis.txt

Mount Point Basics Navigating the Filesystem No drives unlike Windows All files and directory names are in the same hierarchy / home user1 ebasheer Regardless of where they are physically stored thesis.txt Or what underlying storage format/medium is used That is, the hierarchy can span multiple filesystems info.txt bin sbin mnt /home/ebasheer/thesis.txt

File Links Basics File Links Unique files within a single filesystem are identified by inode numbers File names are associated with inode numbers Hard Link Multiple file names referring to the same inode number Symbolic Link Special inode that contains a pathname to another file

Bash Shell The shell is the text based interface to the OS Basics Also referred: console, terminal or command-line Bash is the default shell of virtually all distributions Shell accepts commands Built-in or external Shell Bash is a complete programming language Commands can be combined with control structures e.g. execute command2 if command1 is successful Shell Prompt Shell signals to user that it is ready to accept commands ebasheer@strobe:~$ root@strobe:~#

Current Working Directory Basics Shell Every process has current working directory defined when it starts Including the shell Directory and file related commands operate on the cwd by default The pwd command prints the current working directory to stdout ebasheer@strobe:~$ pwd /home/ebasheer

Command History Basics Shell history command writes out a list of all previous commands executed at the prompt Up/Down arrow to browse through the history Incremental search through history Start: CTRL+r Accept: Esc Abort: CTRL-g

ls List the contents of the current working directory Basics Basic Commands $ ls Desktop Dot files not listed by default Options modify the behavior of commands -a option for ls lists all files Documents $ ls -a....adobe.bash_aliases.bash_history.bash_logout.bashrc Downloads Desktop.dmrc Documents Downloads.gconf.gimp-2.8.gitconfig imgs info opt.gnupg.gtkrc-2.0.gvfs.iceauthority imgs.imgs info tmp VirtualBox VMs.macromedia.modulerc.mozilla.nano.nv.nvidia-settings-rc opt work.selected_editor.ssh.ssh-20160816.sudo_as_admin_successful.thumbnails.thunderbird tmp.vimrc VirtualBox VMs.virtualenvs.wget-hsts work.xauthority.xdefaults

ls Basics List the contents of the current working directory Basic Commands GNU commands support long and short versions of options $ ls --all....adobe.bash_aliases.bash_history.bash_logout.bashrc Desktop.dmrc Documents Downloads.gconf.gimp-2.8.gitconfig.gnupg.gtkrc-2.0.gvfs.ICEauthority imgs.imgs info.macromedia.modulerc.mozilla.nano.nv.nvidia-settings-rc opt.selected_editor.ssh.ssh-20160816.sudo_as_admin_successful.thumbnails.thunderbird tmp.vimrc VirtualBox VMs.virtualenvs.wget-hsts work.xauthority.xdefaults

Short options can be strung together ls -a -l same as ls -al Basics Basic Commands $ ls -al total 288 drwxr-xr-x 36 ebasheer drwxr-xr-x 4 root drwx------ 3 ebasheer -rw-rw-r-- 1 ebasheer -rw------- 1 ebasheer -rw-r--r-- 1 ebasheer -rw-r--r-- 1 ebasheer drwx------ 24 ebasheer drwxr-xr-x 25 ebasheer drwx------ 3 ebasheer drwxr-xr-x 4 ebasheer -rw-r--r-- 1 ebasheer ebasheer root ebasheer ebasheer ebasheer ebasheer ebasheer ebasheer ebasheer ebasheer ebasheer ebasheer 4096 4096 4096 342 7535 220 3893 4096 4096 4096 4096 26 Aug May May Aug Aug May Aug Aug Aug May Aug May 22 9 16 1 22 2 17 22 10 18 22 2 17:29 10:48 15:03 11:09 16:32 12:17 11:03 16:02 17:29 17:14 10:38 18:46....adobe.bash_aliases.bash_history.bash_logout.bashrc.cache.config.dbus Desktop.dmrc

Basics Basic Commands Long and short options can be mixed ls --all -l Most commands have a --help or -h option More detailed information about command usage in man pages To view the man page for a command man <command> Man page for cp command man cp

Basic Commands Man Pages Some options require an argument $ pgrep -u pgrep: option requires an argument -- 'u' $ pgrep -u avahi 5387 5399 $ pgrep -uavahi 5387 5399