Jozef Goetz, 2009 1 expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.

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

Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
A Guide to Unix Using Linux Fourth Edition
Pre-Assessment Questions
1 Introduction to UNIX Ke Liu
UNIX chapter 07 Files and File System Structure
File System Interface CSCI 444/544 Operating Systems Fall 2008.
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
The UNIX File System.
Guide To UNIX Using Linux Third Edition
UNIX Files and Security Software Tools. Slide 2 File Systems l What is a file system? A means of organizing information on the computer. A file system.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Copyrights© 2008 BVU Amplify DITM DATA BASE MANAGEMENT system Page:1 Lesson 2: The File System By Simi.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II CHAPTER 10: ADVANCED FILE PROCESSING.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Chapter 10 File System Interface
Guide To UNIX Using Linux Fourth Edition
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
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”
Manage Directories and Files in Linux
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.
Unix Basics Chapter 4.
RjpSystem Level Programming Operating Systems 1 Having fun withy the Unix Operating System Praxis Week 7 Rob Pooley.
An Introduction to UNIX System --- Cosc513 Presentation n Instructor: Morteza Anvari n Author: Yonghong Pan n ID#: n Date: Jan.29, 2001.
Summer 2015 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to UNIX / Linux - 7 Dr. Jerry Shiao, Silicon Valley University.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Jozef Goetz, expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
The UNIX File System. The UNIX File A file is a container for storing information and data. Filename limited to 255 characters. Can’t contain / or NULL.
June 1, 1999UNIX File System1 Introduction to UNIX D. UNIX File Structure.
Files & File System Structure Most users work mostly with the file system structure and are constantly performing file-related operations such as creating,
Chapter Two Exploring the UNIX File System and File Security.
File System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing (skip)‏ File Protection.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
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:
Chapter Two Exploring the UNIX File System and File Security.
Chapter 4 The File Structure. Contents u The Hierarchical File Structure u Directory and Ordinary Files u Directories u Access Permissions u Links.
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Introduction to Programming Using C An Introduction to Operating Systems.
System Administration – Part 2. Devices in UNIX are files: A device can be accessed with different file names All device files are stored in /dev or its.
Linux Commands C151 Multi-User Operating Systems.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
Jozef Goetz, expanded by Jozef Goetz, 2006 Credits: Parts of the slides are based on slides created by textbook authors, Syed M. Sarwar, Robert.
SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
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 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.
Jozef Goetz, expanded by Jozef Goetz, 2008 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT Files and Filesystems.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
Linux file system "On a UNIX system, everything is a file;
Chapter 6 File Systems CSNB113 SYSTEM ADMINISTRATION
File and File System Structure
C151 Multi-User Operating Systems
An Introduction to UNIX System --- Cosc513 Presentation
Exploring the UNIX File System and File Security
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Chapter 7 File and file System structure
January 26th, 2004 Class Meeting 2
Presentation transcript:

Jozef Goetz, expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert Koretsky, Syed A. Sarwar, 2005 Addison Wesley

Jozef Goetz, Objectives You may ignore last slides 19 – 24 To explain the UNIX file concept To discuss various types of files supported by UNIC To describe attributes of a file To explain the notion of pathnames To explain the user view of the UNIX file system To describe the user’s interface to the UNIX file system - browsing the file system To discuss representation of a file inside the UNIX system To describe how a UNIX file is stored on the disk To explain the concept of standard files in UNIX To cover the commands and primitives ~,.,.., /, PATH, cd, echo, file, ls, mkdir, pwd, rmdir

Jozef Goetz, Types of Files 1. Simple/ordinary file 2. Directory 3. Symbolic (soft) link 4. Special (device) files block special files and character special files 5. Named pipe (FIFO) 6. Socket

Jozef Goetz, Types of Files Simple/ Ordinary File File names – 14 letters in System V letters in BSD UNIX doesn’t impose any naming conventions on files of any types

Jozef Goetz, Types of Files 2. Directory Inode number is 4 bytes and is an index value for an array on the disk. An element of this array is an index node (inode) contains such as file size. UNIX kernel allocates an inode whenever a new file is created cs253u]$ ls -i myFile Where is an index number

Jozef Goetz, Types of Files 3. Symbolic Link Link File A Link File is created by the system when a symbolic link in created to an existing file. it allows you to rename an existing file and share it without duplicating its contents

Jozef Goetz, Special (Device) File A special File is a means of accessing hardware devices, including the keyboard, hard disk, CD-ROM drive, tape drive and printer. Character Special Files Correspond to character-oriented devices (e.g., Keyboard) Block Special Files Correspond to block-oriented devices (e.g., a disk)

Jozef Goetz, Special (Device) File /dev directory contains at least 1 file for every device connected to the computer e.g, fd0 – for floppy drive 0 hda - for hard disk drive a lp0 - for line printer 0 tty – for terminal applications and cmds read/write peripheral device files in the same way that read/write an ordinary file

Jozef Goetz, Named Pipe (FIFO) 6. Sockets Tools that enable processes to communicate with each other client-server paradigm called interprocess communication mechanism – IPC A FIFO is a file that allows 2 processes to communicate with each other, if Ps are on the same computer A socket allows 2 processes to communicate with each other, if Ps are on the different computer On System V UNIX system, a socket file type means a UNIX domain socket

Jozef Goetz, File System Structure File System Organization – => Home and Present Working Directories $HOME, ~, $home - Home Working Directory pwd - Present Working Directory. – current working directory.. – parent of the present working directory Pathnames: Absolute – starting from the root Relative - starting from the present working dir Multiple disk drives: files mounted on the same file system structure can be accessed as if they are part of the file structure one disk Some Standard Directories and Files Root directory (/), /bin, /dev, /etc, /lib…

Jozef Goetz, A Typical UNIX File System Structure

Jozef Goetz, Standard Directories and Files Some Standard Directories and Files / - Root directory /bin – binary files /dev – device files /etc – cmds and files for system administration inetd.conf, login, printcap, rc.d, services, termcap,… passwd –a contains info for users, each line (7 fields) is as follows: login_name:password:user_ID:user_info: home_directory:login_shell From /etc use cmd: cat passwd or cat /etc/passwd /lib – all essential lib /users – hold all the users (home directories) /usr – utilities, tools, language lib, and manual pages /bin - binary images of utilities, tools etc. /lib - language lib /var – other directories and /spool/mail that receives and holds incoming – s /unix or /kernel – binary image of UNIX kernel loaded into memory at bootup time

Jozef Goetz, Navigating the File Structure Determining the Absolute Pathname for Your Home Directory echo [string] echo $HOME Browsing the File System cd [directory] ls [options] [pathname-list]

Jozef Goetz, Navigating the File Structure cs253u]$ ls -ls * // display the content of each directory from the current one // -l use a long listing format // -s, --size print size of each file, in blocks – 1 st number at the column // -S sort by file size 4 -rwxrw-r-- 1 cs253u cs253u 18 Apr 19 11:24 case_demo 4 -rwxrw-r-- 1 cs253u cs253u 155 Apr 26 16:23 d 4 -rwxrw-r-- 1 cs253u cs253u 280 Apr 18 22:48 ex_add_all_ch16 4 -rwxrw-r-- 1 cs253u cs253u 1174 Apr 19 17:20 ex_add_param_my 4 -rwxrwxrwx 1 cs253u cs253u 114 Mar 31 00:31 ex_input 4 -rwxrw-r-- 1 cs253u cs253u 425 Apr 19 14:21 ex_nslookup_lab10_ex6 4 -rwxr-xr-x 1 cs253u cs253u 27 Apr 12 09:48 ex_simple 4 -rwxrw-r-- 1 cs253u cs253u 466 Apr 18 23:11 ex_sum_nat_#_ch16 4 -rw-rw-r-- 1 cs253u cs253u 269 Apr 18 18:47 ex_while 4 -rwxrw-r-- 1 cs253u cs253u 269 Apr 12 01:16 ex_while1 0 -rw-rw-r-- 1 cs253u cs253u 0 Apr 12 15:24 sort mail: total 8 4 -rwx cs253u cs253u 505 Feb 9 17:03 saved-messages 4 -rwx cs253u cs253u 918 Feb 9 17:05 sent-mail personal: total 0 professional: total 0 temp: total 0 cs253u]$

Jozef Goetz, Navigating the File Structure

Jozef Goetz, Creating Files pico, vi, emacs Creating and Removing Directories mkdir [options] dirnames, rmdir [options] dirnames Determining File Attributes ls –l, ls –i, ls –al, ls –F, ls -RC -F, --classify = append indicator (one of to - symbolic link, unix* - executable -R, --recursive = list subdirectories recursively -C list entries by columns ls -RC.: dead.letter m mail mydir myPATH new1./mail: saved-messages sent-mail./mydir: Navigating the File Structure

Jozef Goetz, Navigating the File Structure drwxrwxrwx 1 sarwar faculty 512 May 12 23:44 solutions

Jozef Goetz, Navigating the File Structure $ ls -i courses memos personal $ ls -al ~/courses/ee446/exams drwxr-x-- 1 sarwar faculty 512 Mar 16 08:24. drwxr-x-- 1 sarwar faculty 512 Jan 29 13:27.. -rwxr--r-- 1 sarwar faculty 1863 Mar 16 11:10 mid1 -rwxr--r-- 1 sarwar faculty 459 Apr 11 14:34 mid22 drwxrwxrwx 1 sarwar faculty 512 May 12 23:44 solutions $ ls -F / bin/ dev/ etc/ lost+found/ tmp/ usr/ unix* - symbolic link unix* - executable $ ls -l ~/courses/ee446/lab[^5]*.c [^5] – cannot be 5 $ ls ~/[^0-9]*.[c,C] - not start with a digit and end with c. or C.

Jozef Goetz, Determining the Type of a File’s Contents file [options] file-list $ file * - all files in pwd $ file /* in root all.backup: POSIX tar archive bin:directory dev:directory etc:directory install:symbolic link to var/lib/LST lost+found:directory tmp:directory usr:directory unix:ELF 32-bit LSB executable $

Jozef Goetz, File Representation and Storage in UNIX attributes of a file are stored in a data structure on the disk, called inode:

Jozef Goetz, File Representation and Storage in UNIX UNIX kernel maps the inode of the file lab1.c to its contents on disk use of id # to index the inode table Link Count - # of different names the file has within the system File Mode – what the file was open for read, write, etc User ID – the owner of the file Access Permissions – who can access the file File’s Location on Disk – a direct or indirect pointers to the disk blocks containing file data

Jozef Goetz, Standard Files and File Descriptors uses to index uses to index To open and the issue a file I/O operations : read, write, seek, etc. UNIX automatically opens 3 files for every cmd it executes: sdin, stout and sderr. File descriptor: a small integer that the UNIX kernel attaches with every open file standard input (sdin) — file descriptor 0 standard output (stout) — file descriptor 1 standard error (sderr) — file descriptor 2

Jozef Goetz, Standard Files and File Descriptors The input, output and errors of a command can be redirected to other files by using file redirection facilities in UNIX Here the sdin input – default keyboard stout output – default display screen sderr error – default display screen

Jozef Goetz, Standard Files and File Descriptors The input, output and errors of a command can be redirected to other files by using file redirection facilities in UNIX Here the sdin input 0– default keyboard stout output 1 – default display screen sderr error 2 – was redirected to lab1.c The other descriptors usually range from 3 through 19 are called user-defined file descriptors.