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.

Slides:



Advertisements
Similar presentations
Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology / File Naming Rules Relative vs Absolute pathnames mkdir,
Advertisements

CS 497C – Introduction to UNIX Lecture 11: - The File System Chin-Chih Chang
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.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
Chapter 5 Accessing Files and Directories. How Directories Get Created OS installation: usr, dev, etc, export, kernel and others places to store installation.
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.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  Currently there.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Guide To UNIX Using Linux Fourth Edition
Notes Assignment #1 is due next Friday by 11:59 pm via Test #1 will be held Thursday February 18 at the start of class (one period long) Format:
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.
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”
Chapter 3. The Unix Filesystem. Files and Directories (1) u What is a file? –a container for ordered data –persistent (stays around) and accessible by.
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.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Unix Basics Chapter 4.
June 1, 1999UNIX File System1 Introduction to UNIX D. UNIX File Structure.
Chapter Two Exploring the UNIX File System and File Security.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
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.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
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:
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter Two Exploring the UNIX File System and File Security.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
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
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Unix File System Chapter 6.1 – Unix file system Home directory – A directory set aside for your personal use – The starting point when you log.
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.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Agenda The Linux File System (chapter 4 in text)
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.
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.
BIF703 File Permissions. As you recall from our previous notes, that Unix/Linux recognizes everything as a file: Regular files to store data, programs,
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.
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.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
Agenda The Linux File System (chapter 4 in text)
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
File and File System Structure
The Command Prompt Commands are the way to “do things” in Unix
BIF703 File Permissions.
Operating Systems and Using Linux
Exploring the UNIX File System and File Security
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Module 6 Working with Files and Directories
January 26th, 2004 Class Meeting 2
Presentation transcript:

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 are used to store various items. These concepts relates to both the Linux and Windows Operating Systems. Below are examples of some file types: Regular files – Used to store text, images, executable programs, music, etc. Device files – Used to represent hardware devices such as hard disks, terminals, printers, mouse, keyboard, etc… (stored in the /dev directory - for Linux) Directory files – Used to store regular, device, and other directory files for better organization and quicker access

File System You can use the ls –l command (or dir in Windows) to determine file information. For Example: ls -l /dev/tty crw-rw-rw- 1 root root 5, :07 /dev/tty ls -l monday.txt w1.c -rw-r--r-- 1 murray.saul users :20 monday.txt -rw-r--r-- 1 murray.saul users :36 w1.c ls –ld uli101 drwxr-xr-x 2 murray.saul users :43 uli101 In Linux, you can determine file type from looking at first character in detailed listing: - indicates a regular file b or c indicates a device file d indicates a directory file Note: In MS Windows, the dir command provides information regarding type of file in the listing. For example represents a directory file....

Hierarchical File System In the Linux OS, the "root directory" / is the starting directory (in windows it starts with a disk drive letter like c:\ ). Other "child directories", "grandchild directories”,  etc. are created originating from root dir.c:\ The hierarchical structure resembles an "upside-down tree“. There is actually a command called tree that can display a tree diagram! / <- “root directory” homepublic user1user2user3bif701vi-tutorial

Directory Structure in Linux Directory Path Description / Root directory (ancestor to all directories). /home Used to store users’ home directories. /home/userid User's actual home directory /bin Common system binaries (commands). /usr/bin Common utilities (commands) for users. /usr/sbin Common utilities for user administration. /etc General System administration files. /var Files that continually change (eg. log files) /tmp, /var/tmpTemporary files for programs /dev Device files (terminals, printers, etc

Directory Structure in Windows Directory Path Description c:\c:\, a:\, z:\ Root directory (for that disk drive).a:\ c:\Users Used to store various users’ directories. c:\Users\Username User's actual home directory c:\Windows Common commands & programs. c:\tempc:\temp Temporary files for programs Username\Desktop User's desktop. Username\Documents User's Documents (eg. Word, excel). Username\Pictures User's Pictures.

File Naming Rules The following rules apply to naming regular files or directory files: Some Linux older file systems restrict filename size to 14 characters, most file systems allow for 255 characters (safest to select filename size of 14). Can use letters (upper & lower case), numbers, period, comma or underscore _ characters. Upper case is different than lower case. A period at beginning of filename hides file. MS Windows uses attributes to hide files and directories... Avoid spaces and other punctuation in filenames. MS Windows has less restrictions than Linux in file naming rules...

Pathnames A pathname is a listing of directories that will lead to a directory or a file. The concept of a pathname relates to every operating system including Unix, Linux, MS-DOS, MS-Windows, Apple-Macintosh, etc.! Newer versions of windows allows use of forward slash / as well as backslash \ when specifying file/directory pathnames... Examples: Directory pathname: /home/username/ics124/assignments File pathname: /home/username/ops224/assignments/assn1.txt

Absolute vs Relative Pathnames Absolute Pathname A pathname that begins from root / (or in windows, for example c:\).c:\ The pathname begins with a slash eg. /home/murray.saul/bif713 eg. c:\Users\Userid\Desktop Relative Pathname A pathname that is "relative" to the location of the current or "working" directory.For example, if we are in our home directory, issuing the command mkdir bif713 will create the bif713 directory from our home directory!

Relative Pathnames Rules: A relative pathname does NOT begin with a slash. Many of these rules apply to both Linux and Windows operating systems. Following symbols can be used:.. parent directory (up one directory level). current directory WARNING: When using relative pathname, always make certain you know your present working directory!

Relative Pathnames Examples: Change to another directory branch from parent directory: cd../ipc144 copy sample.c file from your professor ’ s directory to your current directory: cp /home/murray.saul/bif713/exam.txt. (Note: Copy command in Windows is: copy )

Relative-to-Home Pathnames You can specify a pathname as relative-to-home by using a tilde and slash at the start, e.g., ~/bif713/notes.html The tilde ~ is replaced by your home directory (typically /home/your.account/) to make the pathname absolute. You can immediately place a username after the tilde to represent another user’s home directory. For example: ~chris.tyler = /home/chris.tyler but ~ = /home/your_home_dir Relative-to-Home pathnames not available in Windows.

Which Type of Pathname to Use? So far, we have been given many different types of pathnames that we can use for regular files and directories: Absolute pathname (starts with / ) Relative pathname (doesn’t start with /) Relative-to-home pathname (starts with ~) You can decide which pathname type to use to make it more convenient (eg relative – less typing or absolute – you don’t know what directory you are currently located in…)

Making Directories Building directories is similar in approach to building a house Begins from a foundation (eg home directory). Need to build in proper order (add on addition to house in right location). Use a logical scheme. When building directories from different locations, must provide proper absolute or relative pathname!!

Planning Directories Good directory organization requires planning: Group information together logically. Plan for the future: use dated directories where appropriate (~/semester/2009, or ~/semester/2010) Too few directories = excessive number of files in each; too many directories = long pathnames.

Where do we want to build directory? We want to build a directory called tmp that branches-off of your home directory Verify which directory you are located (either look at directory from command prompt or issue the command pwd ). The pwd command not available in Windows. Type mkdir tmp at the Unix prompt, followed by ENTER Always verify that directory has been created (e.g. use ls or ls -ld command). In Windows, use the dir command.

Creating Parent Directories To create directory paths with parent directories that do not exist you can use the command mkdir -p pathname eg. mkdir -p mur/dir1 (This would create the parent directory mur and then the child directory dir1. The -p means "create all the directories in the Path"). Refer to mkdir /? for options in Windows...

Removing Directories  Removing directories is reverse order of building directories Issue command: rmdir directory-pathname rmdir cannot remove directories containing files or other subdirectories. rmdir cannot remove directories that are anyone's current directory. Need to step back to at least parent directory to remove an empty directory.

Removing Sub-trees To remove a sub-tree (a directory and all of its contents including sub-directories) use rm -r directory (or rm -R directory). The command rm – rf removes both subdirectories and files contained in a directory-path. The command rm is not available in Windows (See available option with rmdir command) Caution! rm -r can erase large numbers of files very quickly. Use with extreme care!

Additional File Management Commands

Additional Resources This slide-show provides the minimum amount of Linux and Windows concepts that could appear on a test or final exam. Here are some Related-Links for Interest Only: General Definition of an OS File System: