CMSC 104, Section 301, Fall 20021 Lecture 04, 9/11/02 Operating Systems and Using Linux Review Operating System. Linux Overview. Frequently Used Linux.

Slides:



Advertisements
Similar presentations
CMSC 104, Version 8/061L04Algorithms1.ppt Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
Advertisements

1 Class motto: What’s this button for?. 2 CMSC104 Problem Solving and Computer Programming Fall 2011 Section 4 Richard Chang.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
Computer Software & Software Development H&K Chapter 1 Instructor – Gokcen Cilingir Cpt S 121 (June 20, 2011) Washington State University.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Copyrights© 2008 BVU Amplify DITM DATA BASE MANAGEMENT system Page:1 Lesson 2: The File System By Simi.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
CMSC 104, L031 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Unix Basics Chapter 4.
Cmsc 312 Operating Systems. UNIX? DOS – PC? VAX/VMS - mainframe Unix – PC, workstation, mainframe 1970 bell Lab For computer scientist? Why popular? Free.
ECT 250: Survey of E-Commerce Technology FrontPage Publishing pages Unix.
Linux overview. Architecture Kernel File system Shell: Korn, Bourne, C, Bash X Windows: Motif, Open Look, X.OrgX.Org Desktop: Gnome, KDE,etc.
1 N305 C Programming. 2 Objectives for the Lab ä Learn problem solving strategies ä Achieve intermediate knowledge of C Programming Language ä Gain experience.
Chapter Two Exploring the UNIX File System and File Security.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Operating Systems and Using Linux CMSC 104, Lecture 3 John Y. Park 1.
CMSC 1041 Algorithms I An Introduction to Algorithms.
Algorithms, Part 1 of 3 Topics  Definition of an Algorithm  Algorithm Examples  Syntax versus Semantics Reading  Sections
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter Two Exploring the UNIX File System and File Security.
CMSC 1041 Algorithms I An Introduction to Algorithms.
CMSC 104, Version 8/061L01Introduction.ppt Introduction CMSC 104 Problem Solving and Computer Programming.
CMSC 104, Lecture 011 Course Introduction CMSC 104 Problem Solving and Computer Programming Spring 2002 Section 0801, Wed 7:00-9:30pm Dr. Thomas Gaeng.
Tera Term Brian Smith Chris Vasse Zaheemat Adetoro William Newton Tom Presgraves.
Introduction to Programming Using C An Introduction to Operating Systems.
File Systems, telnet and ftp Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
BIF713 File and Directory Management. File System A File System is a structure used to organize programs and data on a computer ’ s storage device Files.
A gentle introduction to LINUX at the command prompt.
1 UMBC CMSC 104, Section Fall 2002 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Learning basic Unix command It 325 operating system.
CMSC 104, Section 301, Fall Lecture 03, 9/09/02 Operating Systems and Using Linux Topics Review Number Systems. Go over Homework 1 Solution. CSHC.
Operating Systems and Using Linux Courtesy of John Y. Park 1.
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.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
CMSC 104, L041 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Example: The Euclidean Algorithm Syntax versus Semantics Reading Sections 3.1.
Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology File Naming Rules Relative vs Absolute pathnames Unix Commands:
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Algorithms, Part 1 of 3 The First step in the programming process
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Lecture 2 Working with Files and Directories
Algorithms I: An Introduction to Algorithms
Operating Systems and Using Linux
Operating Systems and Using Linux
2008/09/17: Lecture 4 CMSC 104, Section 0101 John Y. Park
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Web Programming Essentials:
Operating Systems and Using Linux
UMBC CMSC 104 – Section 01, Fall 2016
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Operating Systems and Using Linux
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
January 26th, 2004 Class Meeting 2
Presentation transcript:

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Operating Systems and Using Linux Review Operating System. Linux Overview. Frequently Used Linux Commands. Definition of an Algorithm. Algorithm Examples.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Review Operating System A computer program. Performs many operations, such as: Allows you to communicate with the computer (tell it what to do). Controls access (login) to the computer. Keeps track of all processes currently running. At this point, your main concern is how to communicate with the computer using the OS.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Connecting to UMBC Linux Servers See for dtails. Setup your PC for dial-up connections. Dial or with your myUMBC or gl account. (Helpdesk: or ECS 020). Telnet to one of the following linux servers: telnet linux1.gl.umbc.edu telnet linux2.gl.umbc.edu telnet linux3.gl.umbc.edu

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Connecting to UMBC Linux Servers

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Connecting to UMBC Linux Servers

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Connecting to UMBC Linux Servers

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 How Do I Communicate With the Computer Using the OS? (con’t) When you log in to the Linux system here, a user prompt will be displayed: linux#[1]% _ where # is the number of the Linux server that you have connected to. You may use any of the Linux servers. The number in the brackets will change as you work. It is the “number” of the command that you are about to type. If this prompt is not on the screen at any time, you are not communicating with the OS.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Linux Overview Files and Filenames. Directories and Subdirectories. Frequently Used Commands.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Files A file is a sequence of bytes. It can be created by o a text editor (xemacs or pico), o a computer program (such as a C program). It may contain a program, data, a document, or other information. Files that contain other files are called directories (sometimes called folders).

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Linux Filenames Restrictions o May not contain blanks or other reserved characters. o Have a maximum length. o Are case sensitive. It is best to stick with filenames that contain letters (uppercase or lowercase), numbers, and the underscore ( _ ) for now.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Directories Directories contain files or other directories called subdirectories. They may also be empty. Directories are organized in a hierarchical fashion. They help us to keep our files organized.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Directories (con’t) /afs/umbc.edu/users/j/d/jdoe28 junk recipes cmsc104 piescookies projects lectures apple peach choc_chip

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Directories (con’t) Your home directory is where you are located when you log in (e.g., /afs/umbc.edu/users/j/d/jdoe28 ). The current directory is where you are located at any time while you are using the system. Files within the same directory must be given unique names. Paths allow us to give the same name to different files located in different directories. Each running program has a current directory and all filenames are implicitly assumed to start with the name of that directory unless they begin with a slash.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Moving in the Directory Tree. (dot) is the current directory... (dot-dot) is the parent directory. Use the Linux command cd to change directories. o Use dot-dot to move up the tree, e.g., cd.. o Use the directory name to move down, e.g., cd cmsc104. o Use the complete directory name (path name) to move anywhere, e.g., cd cmsc104/proj1.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Wildcard Characters You will find wildcard characters useful when manipulating files (e.g., listing or moving them). The wildcard characters are * and ?. ? is used to represent any single character. * is used to represent 0 or more characters.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Frequently Used Linux Commands pwd – present working directory to check where you are in the directory tree. ls – list of files or subdirectories, e.g., ls proj* or ls –l. cd – change directory to pathname, cd pathname. cp – copy files from file1 to file1b, e.g., cp file1 file1b. mv – rename file from file1 to file2, e.g., mv file1 file2. rm – remove (delete) files, e.g., file1 file2 … mkdir – make directory dir-name, e.g. mkdir dir-name. rmdir – remove (delete) directory, e.g. rmdir dir-name. man – look up how to use the command, man cp. passwd – to change password. ctl-c – to terminate command, process, … Other commands: cat, more.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Frequently Used Linux Commands References: Linux man page. Links from the cmsc 104 homepage. Books and the Internet.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Examples For example, o make a subdirectory for cmsc104, e.g., –mkdir cmsc104, cd cmsc104, and –make subdirectories for projects, lectures, homeworks, exams, e.g., mkdir projects homeworks exams lectures. o Directory tree: cmsc104 exams homeworks lectures projects ex1 ex2 final hw1 … hwn L1 … Ln proj1 … projn

CMSC 104, Section 301, Fall Lecture 04, 9/11/02

CMSC 104, Section 301, Fall Lecture 04, 9/11/02

CMSC 104, Section 301, Fall Lecture 04, 9/11/02

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 linux1[3]% ls -l drwxr-xr-x 2 lichen Sep 9 15:49 Desktop lrwxr-xr-x 1 lichen 32 7 Sep 2 00:38 Mail ->../Mail drwxr-xr-x 2 lichen Aug bin drwx lichen Sep 10 15:25 li lrwxr-xr-x 1 lichen Sep 2 00:38 www ->../pub/www access # links owner group file size last modified date filename r: read w: write x: execute l: link d: directory

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Algorithms, Part 1 of 3 Topics Definition of an Algorithm. Algorithm Examples. Syntax versus Semantics. Reading Sections

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Problem Solving Problem solving is the process of transforming the description of a problem into the solution of that problem. We use our knowledge of the problem domain. We rely on our ability to select and use appropriate problem-solving strategies, techniques, and tools.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Algorithms An algorithm is a step by step solution to a problem. Why bother writing an algorithm? o For your own use in the future. You won’t have to rethink the problem. o So others can use it, even if they know very little about the principles behind how the solution was derived.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Examples of Algorithms Washing machine instructions. Washing hair instructions (ambiguous algorithm). A classic: finding the greatest common divisor (GCD) using Euclid’s Algorithm.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Washing Machine Instructions Separate clothes into white clothes and colored clothes. If white clothes: o Set water temperature knob to HOT. o Place white laundry in tub. If colored clothes: o Set water temperature knob to COLD. o Place colored laundry in tub. Add 1 cup of laundry detergent to tub. Close lid and press the start button.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Washing Machine Instructions (con’t) Observe that There are a finite number of steps. We are capable of doing each of the instructions. When we have followed all of the steps, the washing machine will wash the clothes and then will stop.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Refinement of Algorithm Definition Our old definition: o An algorithm is a step by step solution to a problem. Adding our observations: o An algorithm is a finite set of executable instructions that directs a terminating activity.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Ambiguous Algorithms Washing Hair Instructions: 1. Lather. 2. Rinse. 3. Repeat. How could these instructions be hard to follow?

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Final Version of the Algorithm Definition Our old definition: o An algorithm is a finite set of executable instructions that directs a terminating activity. Final version: o An algorithm is a finite set of unambiguous, executable instructions that directs a terminating activity.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 History of Algorithms The study of algorithms began as a subject in mathematics. The search for algorithms was a significant activity of early mathematicians. Goal: To find a single set of instructions that can be used to solve any problem of a particular type (a general solution).

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Euclid’s Algorithm Problem: Find the largest positive integer that divides evenly into two given positive integers, i.e., the Greatest Common Divisor (GCD). Algorithm: 1. Let M, N be two positive integers, where M > N. 2. Divide M by N and call the remainder R. 3. If R is not 0, then Let M = N, N=R. Go to step Else (R = 0) GCD = N.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Finding the GCD of 24 and 9 MN R Done. So, 3 is the GCD of 24 and 9.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Euclid’s Algorithm (con’t) Do we need to know the theory that Euclid used to come up with this algorithm in order to use it? What intelligence is required to find the GCD using this algorithm?

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 The Idea Behind Algorithms Once an algorithm behind a task has been discovered. o We don't need to understand the principles. o The intelligence is "encoded into the algorithm.“ o The task is reduced to following the instructions.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Algorithm Representation Syntax and Semantics o Syntax refers to the representation itself. o Semantics refers to the concept represented (i.e., the logic).

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Contrasting Syntax and Semantics In the English language, we have both syntax and semantics. Syntax is the grammar of the language. Semantics is the meaning. Given the following sentence, I walked to the corner grocery store. o Is this sentence syntactically correct? o Is it semantically correct?

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Contrasting Syntax and Semantics (con’t) Given the following sentence, I talked to the funny grocery store. o Is this sentence syntactically correct? o Is it semantically correct? How about I grocery store walked corner the to.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Contrasting Syntax and Semantics (con’t) Conclusion: An English sentence may be syntactically correct, yet semantically incorrect. This is also true of algorithms. And it is also true of computer code. Note that it only makes sense to consider semantic if syntax is correct.

CMSC 104, Section 301, Fall Lecture 04, 9/11/02 Next More problem solving and algorithms. Pseudocode. Assignment: o Read 3.1 – 3.10 (skip the C code, just the pseudocode.) o Login to one of the linux servers, perform some of the unix commands from home or school. –linux1.gl.umbc.edu –linux2.gl.umbc.edu –linux3.gl.umbc.edu