Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology File Naming Rules Relative vs Absolute pathnames Unix Commands:

Slides:



Advertisements
Similar presentations
Pre-Assessment Questions
Advertisements

Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology / File Naming Rules Relative vs Absolute pathnames mkdir,
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 -
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
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
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.
CS 497C – Introduction to UNIX Lecture 12: - The File System Chin-Chih Chang
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”
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.
June 1, 1999UNIX File System1 Introduction to UNIX D. UNIX File Structure.
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.
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.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
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.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
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.
Agenda The Linux File System (chapter 4 in text)
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.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
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.
Learning basic Unix command It 325 operating 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.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
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
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
The Unix File System.
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
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology File Naming Rules Relative vs Absolute pathnames Unix Commands: quota, du mkdir, mkdir -p, rmdir rm –r, rm -rf ls, ls -a, ls -F, ls -l, ls -ld

File System A File System is a structure used to organize programs and data on a computer ’ s storage device Linux (Unix) OS has a special file called a directory file used to store ordinary files as well as other directories Directories allow a computer ’ s file system to be better organized

Hierarchical File System In Unix and Linux, the "root directory" / is the starting directory, and contains "child directories", "grandchild directories”, etc. The hierarchical structure resembles an "upside-down tree" / (root) homepublic user1user2user3ipc144unx122

Typical UNIX Directories Directory Path Description / Root directory (ancestor to all files) /home/accountHome directory (where account is name used to login) - this is your working directory when you login /bin, /sbinEssential system binaries (booting) /usr/binCommon utilities (commands) for users /usr/sbinCommon utilities for system administration /etcSystem admin/config files (eg passwd) /varDynamic files (log files) /tmp, /var/tmpTemporary files for programs /devDevice files (terminals, printers, etc. )

File Naming Rules The following rules apply to naming ordinary files and "directory files": Some 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 Avoid spaces and other punctuation in filenames

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.! Examples: Directory pathname: /home/username/unx122/assignments File pathname: /home/username/unx122/assignments/assn1.txt

Absolute vs Relative Pathnames Absolute Pathname A pathname that begins from root The pathname begins with a slash e.g. /home/username/unx122 Relative Pathname A pathname that is "relative" to the location of the current or "working" directory Use cd to set the current directory, pwd to display the working (current) directory e.g. unx122 (assuming we are already in /home/username)

Relative Pathnames Rules: A relative pathname does NOT begin with a slash Following symbols can be used:.. parent directory. current directory Warning: When using a relative pathname, always make sure you know your present working directory!

Relative Pathnames Examples: Change to another directory branch from parent directory: cd../unx122 copy sample.c file from your professor ’ s directory to your current directory: cp /home/profname/ipc144/sample.c.

Relative-to-Home Pathnames You can specify a pathname as relative-to- home by using a tilde and slash at the start, e.g. ~/unx122/notes.html The tilde ~ is replaced by your home directory (typically /home/your.account/) to make the pathname absolute

Why Learn File Management? To keep your home directory organized (less searching to find your files) If files are not FTP’d to other locations and removed, you will run out of disk space Consequences of Not Removing Unused Files: - Programs such as cc will not run properly - Your account may be suspended!

quota command The quota command displays the user’s disk quota and usage. This information is given in terms of blocks and number of files: $ quota Disk quotas for user lczegel (uid 6444): Filesystem blocks quota limit grace files quota limit grace server13:/home/

du command The du command reports file space usage (in blocks) of directory path specified - all directories within the specified directory will be displayed $ du dir1 100dir1/vi_tutorial 1048dir1/lab3 2116dir1/samples 4164dir1 Options: -a display files as well as directories -k display in kbytes rather than blocks Total size (in blocks) of specified directory (dir1) Directory paths and sizes

Creating a Directory Structure Begin from a foundation (e.g. home directory) Add directories in proper order - use a logical scheme When adding 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 (~/2004/Winter, ~/2004/Summer) Too few directories = excessive number of files in each; too many directories = long pathnames

Where do we want to build directory? Want to build a directory called tmp that branches-off from your home directory Verify directory in which you are located (either look at directory from command prompt or issue the command pwd ) Type mkdir tmp at the Unix prompt, followed by Always verify that directory has been created (e.g. use ls or ls -ld 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 unx122/lab1 (This would create the parent directory unx122 and the child directory lab1. The -p means "create all directories in the path that don’t already exist")

Removing Directories Removing directories is reverse order of building directories Issue command rmdir directory 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 subdirectories) use rm -r directory (or rm -R directory). The command rm –rf removes files that are write-protected and issues no messages (-f means “force”). Caution! Back-up your files before removing. You can use the ftp application to transfer files to another server or your diskette. Refer to next set of notes to learn how to use command-line ftp. Caution! rm -r can erase large numbers of files very quickly. Use with extreme care!

Listing Directory Contents lsCompact listing of non-hidden files ls -aCompact listing of ALL files ls -lDetailed (long) listing of non-hidden files ls -FDisplays symbols to mark directories (/) and executable files (*) ls -ldDisplays a detailed (long) listing of only specified directory rather than the contents of that directory