August 31, 2010Joris Geurts1 2IN05 Operating Systems Introduction to Linux More information for this course:

Slides:



Advertisements
Similar presentations
CSCI 1730 April 1 st, Materials Class notes slides & some “plain old” html & source code examples linked from course calendar board notes & diagrams.
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
1 Introduction to UNIX Ke Liu
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
Introduction to Linux/UNIX. History UNIX beginnings in 1969 (Linus Torvalds is born!) AT & T Bell Laboratories (Ken Thompson & Dennis Richie) Working.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
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.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Operating System Tutorial 1
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
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”
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Unix Basics Chapter 4.
CENT 305 Information Systems Security Linux Introduction.
Introduction to Computer Organization & Systems Topics: Intro to UNIX COMP John Barr.
2INC0 Operating Systems Introduction to Linux
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification Chapter Four Exploring Linux Filesystems.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
LINUX Tuesday, 5 July :00 pm. Remote Login l Use Secure Shell (ssh) l Machine name/IP address E.g. ssh hydra.sma.nus.edu.sg Or ssh
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
CS 590 Programming Environments with UNIX. Computer Lab Account Course Homepage
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
UNIX File System by Tero Toikkanen, CAP02S. UNIX Multi-user system Multi-user system Multi-tasking system Multi-tasking system Wide selection of tools.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
UNIX An Introduction. Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering.
40 Years and Still Rocking the Terminal!
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Use of the Virtual Machine Review week two lab assignment This week’s expected.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
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.
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Embedded Software Design Week II Linux Intro Linux Kernel.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
1 2INC0 Operating Systems practical (part 1) Joris Geurts.
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
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.
CIRC Winter Boot Camp 2017 Baowei Liu
Some Linux Commands.
The Linux Operating System
Introduction to UNIX.
C Programming Lecture Series
Introduction to Linux Week 0 - Thursday.
Introduction to Linux/UNIX
Linux Shell Script Programming
Presentation transcript:

August 31, 2010Joris Geurts1 2IN05 Operating Systems Introduction to Linux More information for this course:

August 31, 2010Joris Geurts2 What is Linux?

August 31, 2010Joris Geurts3 Linux is a UNIX-like operating system separation between kernel and user mode

August 31, 2010Joris Geurts4 characteristics developed in 1970's by Ritchie and Thomson multi user multi tasking

August 31, 2010Joris Geurts5 advantages different hardware: IBM, DEC, Intel, ARM simple structure elaborate software tooling command interpreter: the SHELL principles applied in a consequent way

August 31, 2010Joris Geurts6 disadvantages cryptic names, e.g.: cat filename cryptic syntax: \ / * $ " ' ` ~ e.g.: grep "*.$1" `pick *.c` | lpr many members of the family, and they differ

August 31, 2010Joris Geurts7 Unix family tree

August 31, 2010Joris Geurts8 Some Unix characteristics ‘Everything is a file’ –including screen, mouse, hard disk etc. All (system) commands are just applications –including login procedure, file and directory management, –large and powerful set of commands The central role of the shell (command interpreter) –typing rather than clicking Built-in management of different users –multi-tasking and multi-user

August 31, 2010Joris Geurts9 Linux take-off

August 31, 2010Joris Geurts10 Initial family tree Since then –many different distributions, with different characteristics –specialized versions (real-time, embedded)‏ –powers the Internet

August 31, 2010Joris Geurts11 Linux distributions (600+) kernel + libraries + software applications

August 31, 2010Joris Geurts12 Linux desktop environments GNOME KDE

August 31, 2010Joris Geurts13 Using Linux The setup for this course –VMware Player –Ubuntu Linux – Short demonstration –Starting the system –Using the terminal Some small practical assignments –On the next slide – (check.html & linux.html)

August 31, 2010Joris Geurts14 Command summary Commands (find out their functionality) –ls –mkdir, cp, mv, which, chmod, echo, grep, pwd, cat, ps –man input/output redirect –ls > file –command1 | command2 | command3 –cat /etc/passwd | sort | less –less /etc/passwd editors –kate, gedit, vi –(to be installed) emacs, joe, nano, eclipse

August 31, 2010Joris Geurts15 Practical assignments (shell) Startup and login to the system –Username: user Password: user Create a directory in –Your home directory (/home/user/) –The temporary directory (/tmp/) –The root directory (/) Copy the password file to your home directory Search where the ls binary is located –Determine its owner and permissions –Record this information in a file –Take a look at its manual page

August 31, 2010Joris Geurts16 Linux documentation Manual pages (from UNIX system) –User commands (sec. 1), system calls (sec. 2), library routines (sec. 3), file formats (sec. 5), management (sec. 8) man itemman bash man section itemman 5 passwd man –k topicman –k copy Info documents (from GNU tools) –Pre-HTML hyperlink documentation system info iteminfo gcc HTML (from www era) –Integrated in Help browsers of Linux distributions khelpcenter & gnome-help &

August 31, 2010Joris Geurts17 Development process Single file applications –Call compiler directly or via a shell script Command: gcc –o myapp myapp.c Medium size applications –Create a Makefile Describe dependencies and how to resolve them –Use ‘make’ command to (re)build the application Large or portable applications (not in 2IN05) –Use ‘autoconf’, ‘automake’ and ‘libtool’ –Perform platform detection on the build host –Support for cross compilation Build applications for embedded devices

August 31, 2010Joris Geurts18 C programming language Language of the Linux kernel and many of the applications Very low-level – portable assembly (although...) –No memory protection –No garbage collection –No decent string type –Direct memory pointer manipulation High execution performance possible –At the cost of a longer development time

August 31, 2010Joris Geurts19 Hello World see compile and run $ gcc -o helloworld helloworld.c $./helloworld printf printf ("Hello World\n"); printf ("decimal display: %d\n", i); printf ("hexadecimal display: %04x\n", i); debugger…

August 31, 2010Joris Geurts20 Debugging with kdbg sudo apt-get install kdbg (only once) gcc -g –Wall –o myapp myapp.c kdbg myapp & –set breakpoints –press Run, Step Over etc. –inspect variables

August 31, 2010Joris Geurts21 Example program Read from the file ‘/etc/passwd’ Write the usernames to the file ‘users’ Useful commands: gcc –Wall –o myapp myapp.c man 3 fgets man 5 passwd Note: to run your application, use:./myapp –Otherwise an existing application might be started instead

August 31, 2010Joris Geurts22 Example program #include int main(int argc, char *argv[]) { char linebuffer[1024]; FILE *input; FILE *output; /* Open /etc/passwd for reading. */ input = fopen(“/etc/passwd”, …); if (input == NULL) { fprintf(stderr, “Unable to open /etc/passwd for reading\n”); return 1; } See manual of fopen() parse the linebuffer to find the ':' characters /* Open “users” for writing. */ output = fopen(“users”, …); if (output == NULL) { fprintf(stderr, “Unable to open users for writing\n”); return 1; } /* Process the input file line by line */ while (!feof(input) && !ferror(input)) { char *rtn; rtn = fgets(linebuffer, …, …); if (rtn != NULL) {..... …. fprintf(…, “%s\n”, …); } /* Close the files */ fclose(…); }

August 31, 2010Joris Geurts23 arrays root:x:0:0:root:/root:/bin/bash linebuffer (a character array) linebuffer[0] contains a 'r' linebuffer[1] contains a 'o', etc.

August 31, 2010Joris Geurts24 Practical assignments Install some tooling – sudo apt-get install manpages-dev Example program on the website –Source available at the website: fill in the gaps –Compile and run –Change the makefile: create a debug build, and run with kdbg Extra: use strsep() instead of your own parsing Extra: give a shell command for this task –Use awk, sed or some other tool –Just read the manual pages –It can be done in one line; which approach is the most efficient?