CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Directories.

Slides:



Advertisements
Similar presentations
MORE FILE ATTRIBUTES. ls –l to display file attributes (properties) Listing of a specific directory Ownership and group ownership Different file permissions.
Advertisements

The Unix File System. What are the three parts of every file on a Unix filesystem? And where is each stored? Filename - stored in directories Inode -
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.
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
The UNIX File System CS465. File Systems What is a file system? A means of organizing information on the computer. A file system is a logical view, not.
Linux+ Guide to Linux Certification, Second Edition
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Linux Linux File System.
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.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting RSS.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Getting Started with Linux Linux System Administration Permissions.
CSCI 1730 April 2 nd, C review – 4 data types /* A review of the basic data types in C. */ #include int main() { intx,y; chara; floatf,e; doubled;
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting XML.
CIT 383: Administrative Scripting
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2011 by the Trustees of Indiana University except as noted.
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.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Writing Methods.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Methods and Hashes.
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
Chapter 4 The File Structure. Contents u The Hierarchical File Structure u Directory and Ordinary Files u Directories u Access Permissions u Links.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
PacNOG 6: Nadi, Fiji UNIX ™/ /Linux Permissions Hervey Allen Network Startup Resource Center.
Privileges: who can control what Introduction to Unix June 16, 2009 Papeete, French Polynesia Hervey Allen.
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Regular Expressions.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting HTTP.
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Numbers.
Linux Filesystem WeeSan Lee. Roadmap Disk Partitions The Filesystem Filesystem Mouting & Umounting File Tree File Type File Permission.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting DateTime.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
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.
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
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.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Linux Filesystem Management
Privileges: who can control what
File permissions Operating systems I800
Lecture 2 Working with Files and Directories
CIT 383: Administrative Scripting
CIT 383: Administrative Scripting
Privileges: who can control what
CIT 383: Administrative Scripting
CIT 383: Administrative Scripting
CIT 383: Administrative Scripting
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
CIT 383: Administrative Scripting
Security and File Permission
CIT 383: Administrative Scripting
CIT 383: Administrative Scripting
CIT 383: Administrative Scripting
Software I: Utilities and Internals
CIT 383: Administrative Scripting
CIT 383: Administrative Scripting
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

CIT 383: Administrative ScriptingSlide #1 CIT 383: Administrative Scripting Directories

CIT 383: Administrative Scripting Topics 1.Directories 2.Inodes 3.File Management 4.Command Line Arguments

CIT 383: Administrative Scripting Directories Directory: table of name to inode mappings $ ls –i / bin boot cdrom 2260 dev etc 2 home initrd initrd.img initrd.img.old lib

CIT 383: Administrative Scripting Accessing Directories thisdir = Dir.new(pathname) absolutedir = Dir.new(‘/home/smi/dir1’) relativedir = Dir.new(‘smi/dir1’) currentdir = Dir.new(‘.’) uponedir = Dir.new(‘..’) Methods entries : returns array of filenames each : iterates over each file in directory

CIT 383: Administrative Scripting Inodes An inode is a disk structure that contains  Size of the file in bytes.  Device ID that identifies device where file is located.  UID of the file’s owner.  GID of the file’s group.  File mode (permissions.)  Timestamps ctime: inode change time mtime: time file content was last modified atime: time file content was last accessed  Reference count that identifies how many directory entries point to inode.  Pointers to disk blocks containing file data.

CIT 383: Administrative Scripting Hard and Symbolic Links A hard link is  A directory entry that points to an inode.  Deleting a file with rm just removes the directory entry.  File data is not removed until all links removed. A symbolic link is  A file that contains a pathname.  Deleting the link does not affect the file.  Deleting a file with rm invalidates the symbolic link but does not remove it from filesystem.

CIT 383: Administrative Scripting Basic File Permissions Three sets of permissions: owner, group, world  Each set represented by an octal digit.  Each permission (r,w,x) one bit in octal digit.  Special permissions: setuid, setgid, sticky. ex: chmod 0644 file u: rw, g: r, o: r ex: chmod 0711 bin u: rwx, g: x, o: x 4readsetuid 2writesetgid 1executesticky

CIT 383: Administrative Scripting File::Stat The File::Stat class allows access to inodes stat = File::Stat.new(pathname) OR file = File.new(pathname) stat = file.stat Methods size : size of file in bytes uid : UID of file owner gid : GID of file owner mode : file permissions in octal mtime,ctime,atime : file timestamps

CIT 383: Administrative Scripting Querying File Attributes directory? – Is file a directory? symlink? – Is file a symbolic link? file? – Is file an ordinary file (not a directory, device, or symlink)? readable? – Is file readable by me? writable? – Is file writable by me? executable? – Is file executable by me? setuid? – Is file setuid? setgid? – Is file setgid? sticky? – Is the sticky bit set?

CIT 383: Administrative Scripting File Management The FileUtils class provides methods that emulate the functionality of UNIX commands: chmod chown cp ln mkdir mv rm rmdir

CIT 383: Administrative Scripting Command Line Arguments Using command line arguments./test.rb arg1 arg2 arg3 Accessing command line arguments Ruby provides them via the ARGV array: ARGV.each do |arg| puts arg end

CIT 383: Administrative ScriptingSlide #12 References 1.Michael Fitzgerald, Learning Ruby, O’Reilly, David Flanagan and Yukihiro Matsumoto, The Ruby Programming Language, O’Reilly, Hal Fulton, The Ruby Way, 2 nd edition, Addison- Wesley, Robert C. Martin, Clean Code, Prentice Hall, Dave Thomas with Chad Fowler and Andy Hunt, Programming Ruby, 2 nd edition, Pragmatic Programmers, 2005.