Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems Upcoming.

Slides:



Advertisements
Similar presentations
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Advertisements

Chapter 10: File-System Interface
1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
Chapter 10: File-System Interface
File System Interface CSCI 444/544 Operating Systems Fall 2008.
Linux+ Guide to Linux Certification, Second Edition
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Bash Shell Scripting 10 Second Guide Common environment variables PATH - Sets the search path for any executable command. Similar to the PATH variable.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This week’s expected outcomes Next lab assignment.
Chapter 10 File System Interface
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Introduction to Shell Script Programming
1Fall 2008, Chapter 11 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Upcoming deadlines Lab.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Week Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems.
Linux+ Guide to Linux Certification, Second Edition
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Linux Operations and Administration
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.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
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.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
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.
Chapter Two Exploring the UNIX File System and File Security.
Lecture 24CS311 – Operating Systems 1 1 CS311 – Lecture 24 Outline Final Exam Study Guide Note: These lecture notes are not intended replace your notes.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
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.
Chapter Six Introduction to Shell Script Programming.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
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.
Linux Commands C151 Multi-User Operating Systems.
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.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Week Five Agenda Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
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.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
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.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Week Seven Agenda Link of the week Review week six lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Linux Filesystem Management
File System Interface CSSE 332 Operating Systems
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Linux file system "On a UNIX system, everything is a file;
Lecture 2 Working with Files and Directories
Sydney Opera House.
ITEC400 Week Three Professor Robert D’Andrea
Operation System Program 4
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Internal Representation of Files
Presentation transcript:

Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems Upcoming Deadlines Lab Assistance, Questions, and Answers

Link of the week What is object code? Object File Format

Link of the week What is object code? An object file is a file containing object code, meaning relocatable format machine code that is usually not directly executable. Object files are produced by an assembler, compiler, or other language translator, and used as input to the linker, which in turn typically generates an executable or library by combining parts of object files. There are various formats for object files, and the same object code can be packaged in different object files.

Link of the week f45 4c e e e 726f e d e e c61 2e e63 6f6d 6d65 6e de3 bf88 f027 a044 f227 a048

Link of the week Object code produced by a compiler Programmers write programs in a high-level language called source code (Java or C Language). The source code consists of instructions in a particular language, like C, C++, or Java. However, computers can only execute instructions written in low-level language called machine language.

Link of the week What is Object File Format? An object file format is a computer file format used for the storage of object code and other related data. There are many different object file formats; originally each type of computer had its own unique format, but with the advent of UNIX software portability, some formats, such as COFF and ELF became the de facto standard used on different kinds of operating systems. It is possible for the same file format to be used both as linker input and output, and thus as the library and executable file format.

Link of the week

Course expected outcome Learning Outcomes (Week four) Write Perl scripts, including variables, control flow, and regular expression syntax

UNIX Operating System UNIX file system When we talk about a UNIX file system, we are actually referring to an area of physical memory represented by a single i-list. A UNIX machine may be connected to many different file systems, each with its own i-list. One of those i-lists points to a special storage area, known as the root file system. The root file system contains the files for the operating system itself, and must be available at all times.

UNIX Operating System Some file systems are considered removable. A removable file systems can be attached, or mounted, to the root file system. Typically, an empty directory is created on the root file system as a mount point, and a removable file system is attached to that empty directory. When you issue a cd command to access the files and directories of a mounted removable file system, your file operations will be controlled through the i-list of the removable file system.

UNIX Operating System The purpose of the i-list is to provide the operating system with a map into the memory of some physical storage device (disk drive). The map is continually being updated, as the files are created and removed, and as they grow and shrink in size. Thus, the mechanism of mapping must be very flexible and robust in order to accommodate drastic changes in the number and size of files. The i-list is stored in a known location, on the same memory storage device that it maps.

UNIX Operating System Each entry in an i-list is called an inode. An inode is a data structure that provides the flexibility to track the changing file system. The inodes contain the information necessary to get information from the storage device, which typically communicates in fixed- size disk blocks.

UNIX Operating System An inode contains 10 direct pointers, which point to disk blocks on the storage device. In addition, each inode also contains one indirect pointer, one double indirect pointer, and one triple indirect pointer. The indirect pointer points to a block of direct pointers. The double indirect pointer points to a block of indirect pointers, and the triple indirect pointer points to a block of double indirect pointers. By structuring the pointers in a geometric fashion, a single inode can represent a very large file.

UNIX Operating System It should make a bit more sense to view a UNIX directory as a list of i-numbers, each i- number referencing a specific inode on a specific i-list. The operating system traces its way through a file path by following the inodes until it reaches the direct pointers that contain the actual location of the file on the storage device.

UNIX Operating System UNIX inode attributes The POSIX standard mandates file system behavior that is strongly influenced by traditional UNIX file systems. Regular files must have the following attributes: The size of the file in bytes. Device ID (this identifies the device containing the file). The User ID of the file's owner. The Group ID of the file. The file mode which determines the file type and how the file's owner, its group, and others can access the file.

UNIX Operating System Additional system and user flags to further protect the file (limit its use and modification). Timestamps telling when the inode itself was last modified (ctime, inode change time), the file content last modified (mtime, modification time), and last accessed (atime, access time). A link count telling how many hard links point to the inode. Pointers to the disk blocks that store the file's contents (see inode pointer structure).

UNIX Operating System The UNIX file system relies on data structures about files, beside the file content. The inode content information is considered metadata data that describes data. Each file has a number associated with it, which is called an inode number.

UNIX Operating System

UNIX directory  In UNIX, directories are files which contain information about other files. A UNIX directory is a file whose data is an array or list of (filename, i- node#) pairs. – It has an owner, group owner, size, access permissions, etc. – Many file operations can be used on directories – As a file, a directory has an i-node type structure. – A flag in the structure indicates its type.

UNIX Operating System UNIX directory Unlike other files, the kernel imposes a structure on directory files using the UNIX command mkdir. A directory is a sequence of lines, a sequence of directory entries of variable length where each line contains an inode number and a file name mapping:

UNIX Operating System UNIX command mkdir sub_dir The creation of a sub_dir directory file and an inode for it An inode number and name are added to the parent directory file Directory sub_dir dump script

UNIX Operating System dump 45270script core1 2022core ksh 2324csh

UNIX Operating System Dot and dot-dot files “.” and “..” are stored as ordinary file names with inode numbers pointing to the correct directory files.

UNIX Operating System File system directory structure  The file system directory structure is a link between the inode hash list and the directory files.  The root “/” inode is always number 2. The root “/” directory file data block is located thru inode number 2.  Directory file entries include each entry. Where file name is the local (unqualified) directory or regular file name within the directory and inode number is an index into the inode hash array.  The (inode number) inode in the hash list entry has pointer to the data block of the subsequent regular file or directory file data block.

UNIX Operating System File system directory structure  If it is a directory file, the directory data blocks are read for the next, and the process repeats.

UNIX Operating System File system directory structure If it is a regular file, the data blocks are located and read. This process also explains the difference between hard links and soft links. A hard link directory entry is a direct pointer to a file inode. A soft link is a pointer to another directory entry. In a link, rm clears the directory record. Usually, this means that the inode number is set to 0 but the file may not be affected. The file inode is only deleted when the last link to it is removed; the data block for the file is also deleted (reclaimed).

UNIX Operating System Disk drive

UNIX Operating System File system data structure Disk drive File system inode...inode Boot Block Super Block I-List Data blocks for files, and directories. Partition

UNIX Operating System Hard link

UNIX Operating System Soft link

UNIX Operating System Link (ln) command The ln command is used to create a hard and soft link. Hard link (physical): ln original_file.txt hard_link.txt Soft link (symbolic): ln –s original_file.txt soft_link.txt

UNIX Operating System UNIX directory  Directory data is stored as binary, and cannot be displayed using the cat command. But some older versions of UNIX allow: od -c dir-name.  Although directories are files, UNIX permissions – rwx- have slightly different meanings: - r, lists directory contents - w, add a file to the directory - x, cd to the directory

UNIX Operating System User process accessing data  Given the file name. To get to the file’s control block (FCB), use the file system catalog (Open, Close, Set_Attribute)  The catalog maps a file name to the file control block – Checks permissions  file_handle=open(file_name): – Search the catalog and bring file control block into the memory – UNIX: in-memory file control block: in-core i- node

UNIX Operating System User process accessing data  Use the file control block to get to the desired offset within the file data: (CREATE, DELETE, SEEK, TRUNCATE)  close(file_handle): release file control block from memory

UNIX Operating System What is a filter? A UNIX filter command performs an operation or manipulation of the input text from a file. Standard in and out are typically used during this operation. UNIX Command Line Filters awk, cat, cut, expand, compress, fold, grep, head, nl, perl, pr, sed, sh, sort, split, strings, tail, tac, tee, tr, uniq, and wc

UNIX Operating System File System Filters cat, cd, chmod, chown, chgrp, cksum, cmp, cp, dd, du, df, fsck, fuser, ln, ls, lsattr, lsof, mkdir, mount, mv, pwd, rm, rmdir, split, touch, umask Processes Filters at, chroot, cron, exit, kill, killall, nice, pgrep, pidof, pkill, ps, pstree, sleep, time, top, and wait

UNIX Operating System Test Command A common way to set up a condition for the if command is with the test command. test condition or [ condition ] The test command evaluates the condition and returns 0 or 1, depending on the results of the test. The brackets work exactly like the test condition. The open bracket is a link to test.

UNIX Operating System Constructing Conditions -s file-r file-w file -S file -x file-f file-d file Examples: if [ ! –f /etc/quotatab ] Does the plain file named /etc/quotatab not exist? If [ -d /etc/rc0.d ] Is the /etc/rc0.d name a directory?

UNIX Operating System Constructing Conditions -S file = True if the file exists and its size is greater than zero. -s file = True if the file exists and is a socket. -w file = True if the file exists and is writable. -x file = True if the file exists and is executable. -f file = True if the file exists and is a regular file -d file = True if the file exists and is a directory.

UNIX Operating System Perl and Shell Similarities Perl ~ Shell $# Perl $ARGV[0] ~ Shell $1 Perl $ARGV[1] ~ Shell $2 Perl ~ Shell if [ $# != 2] All Perl statements are terminated with a “;” Perl exit 0 is returned if execution was successful. Perl exit 1 is returned if execution fails.

UNIX Operating System Perl syntax $? - this variable contains the return value # - precedes a comment statement in Perl \n - new line syntax “ …” $strexp = “This text is considered as a string”; ‘ …’ $charexp = ‘a’; ` …` $cmdexp = `ls – array containing command line arguments $_ - default implied scalar

UNIX Operating System Relational operators There are two types of relational operators. One class operates on numeric values, the other on string values. Relational operators Numeric String Meaning > gtGreater than >= ge Greater than or equal < lt Less than <= leLess than or equal

UNIX Operating System Equality Operators Numeric String Meaning == eq Equal to != ne Not equal to  cmp Comparison, sign results -1 if the left operand is less than right operand 0 If both operands equal to right operand 1 If the left operand is greater right operand

UNIX Operating System Equality Operators if ( $count != 5 ) { print "The counter is NOT equal to 5.\n"; } if ( $response eq 'YES‘ ) { print "You said YES"; } else { print "I don't know what you said, but it wasn't YES"; }

UNIX Operating System Initial Perl design Perl is designed to - Process text data - Perform pattern matching - Utilize string handling tasks Perl is available on many platforms - UNIX - Linux - HP-UX - Red Hat Linux Enterprise

UNIX Operating System Perl utilizes two types of categories Singular variables that represent a single-value. The variable prefix symbol for a scalar is the $. Plural variables are ones that contain multiple- values. Arrays and hashes are two multi-valued variables. The variable prefix symbol for an array and hash and %, respectively.

UNIX Operating System Perl data types $answer = 42; (an integer) $pi = ; (a “real” number) $animal = “horse”; (string) $statement = “I exercise my $animal”; (string with interpolation) $amount = ‘It cost me $5.00’; (string without interpolation) $cwd = `pwd`; (string output from a command)

UNIX Operating System Initialize Perl array Definition: An array is an ordered list of scalars, accessed by the scalar’s position in the = (“car”, “mower”, = (“Will”, “Karim”, “Asma”, “Jay”); $count

UNIX Operating System Perl Formats if ( … ) { … } while ( … ) { … }

UNIX Operating System Perl Formats for ( initialize variable, test variable, increment variable) { … }

UNIX Operating System Perl formats if ($append) { open(MYOUTFILE, ">filename.out"); #open for write, overwrite } else { open(MYOUTFILE, ">> filename.out"); #open for write, append }

UNIX Operating System Points of interest UNIX uses a hierarchical file system for storing files. This system consists of a "root" directory which is made up of sub-directories which in turn are made up of sub-directories. All UNIX directories contain a dot (.) and dot- dot (..) files.

UNIX Operating System Demonstrate Perl script:./week_four.pl

UNIX Operating System Moving Around in UNIX pwd rmdir telnet sftp talk passwd w finger write

Break-out problems $strexp = “This text is considered as a string”; $intexp = 10; $floatptexp = 2.54; $charexp = ‘a’; $cmdexp = `ls –l`; $argexp = (“two”, “four”, = (“Jackie”, “Vicki”, “Alex”); $array [0] = “new value”; $a = $b + 5; $container ($map{blue}, $map{orange}, $map{jade}) = (0xff0000, 0x00ff00, 0x0000ff0);

Hands-On-Information Lab Assignment 3-1, Advanced Scripting, due February 1, Lab Assignment 4-1, Simple Perl Exercise, due February 8, Read Chapters 1 and 2 in Essential System Administration text. Read Module Two listed under the course Web site. Everyone should have received a Perl Quick Reference document and script logic for Lab Assignment 4-1.

After class assistance Questions? Comments? Concerns? After each Franklin Live session, I will remain on the session to provide assistance unless otherwise indicated.

Lab Assistance available by phone and/or