Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID 121779 COSC 513 Operating System.

Similar presentations


Presentation on theme: "1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID 121779 COSC 513 Operating System."— Presentation transcript:

1 1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID 121779 COSC 513 Operating System

2 2 Why you should know UNIX - FREE ! FREE ! FREE !!!!!! - Source code is openly available - Linux, its background in UNIX, will soon have a lead position in the mid to high-end server market

3 3 The UNIX File System DISK ORGANIZATION - UNIX allows you to divide your hard disk into many units (called directories), sub units (called subdirectories) - UNIX provides commands to create, organize, and keep track of directories and files on the disk.

4 4 FILE TYPES UNDER UNIX Regular files - Contain sequences of bytes that could be programming code, data, text, and so on. Directories files - Contain information (like the file name) about other files. It consists of a number of such records in special format defined by your operating system. Special Files (device files) - Contain specific information corresponding to peripheral devices such as printers, disk, and so on. UNIX treats I/O devices as files, and each device in your system.

5 5 ABOUT DIRECTORY The directory structure is organized in levels and is known as a hierarchical structure. The highest level is called the ‘root’. Do not contain the information but instead provide a reference path to allow you to organize your files.

6 6 ABOUT DIRECTORY Directory Structure bin lib usr dev root

7 7 Important Directories /usr : holds users’ home directories. Similarly to /home in Linux /bin : holds many of the basic UNIX program files. holds many of the basic UNIX program files. bin stands for binary, and these files are executable files. /dev : holds device files. /etc : holds many of UNIX configuration files. /sbin : holds system files that usually are run automatically by UNIX system.

8 8 Path and Pathnames Every file has a pathname. The pathname locates the file in the file system. 2 types - Absolute Pathname - Relative Pathname

9 9 Path and Pathnames / / / (root pathname) bin lib usr dev /usr (usr pathname) Root Subdirectories david daniel gabriel user subdirectories /usr/david pathname) myfirs t report /usr/david/myfirst (myfirst pathname) / usr/david/report (report pathname) Pathnames in a Directory Structure

10 10 Absolute Pathname Traces a path from the root to the file. Using when you want to access file that is not in your current directory. Always use the forward slash (/) at the beginning of the pathname for the root directory.

11 11 Relative Pathname Traces a path from current directory to the file. Using when you want to access file that is in your subdirectories of your current directory. There is no initial forward slash (/)

12 12 Using File and Directory Name The maximum length depend on the UNIX version, up to 255 characters. Avoid to use <>,(),[],{},*,?,”,’,-,$,^ Can’t use spaces ( ), in files name Using more than one dot is allowed in UNIX Case sensitive

13 13 Directory Command Displaying a Directory pathname: The pwd (print working directory) command. Changing your Working Directory: The cd command Creating Directories The mkdir Command Removing Directories: The rmdir Command Listing Directories: The ls Command

14 14 The pwd command Display the absolute pathname of your working directory. Similarly to chdir command in DOS

15 15 The cd command Change your current directory cd $HOME using when want to return your directory. Similarly to cd command in DOS

16 16 The mkdir Command Create new subdirectory under your working directory Similarly to md or mkdir command in DOS Using option –p to create level directories in single command Example mkdir –p /level1/level2/level3 means create directory level1 in current directory and create directory level2 in level1 directory and create level3 in level2 directory

17 17 The rmdir Command Remove existing directory Must be in the parent directory to remove subdirectory. Must remove only empty directory. Similarly to rd or rmdir command in DOS

18 18 The ls Command List subdirectories and files in current directory. Can use multiple options in single line Similarly to dir command in DOS

19 19 Display File Contents: Using the cat Command - To display file contents. - Usually use with small files. - Similarly to type command in DOS.

20 20 Printing File Contents The lp command - To send a copy of a file to the printer for producing a hard copy of the file. - Can specify several files on one command line. - Similarly to print command in DOS.

21 21 Printing File Contents The cancel command - To cancel request for print jobs made with the lp command. The lpstat command - To obtain information about printing requests and the status on the printers.

22 22 FILE MANIPULATION COMMANDS  Copying Files: The cp Command  Moving Files: The mv Command  Linking Files: The ln Command  Deleting files : The rm command

23 23 The cp Command Used to create a copy (duplicate) of a file. Syntax $ cp [option] [Source] [Destination] Source and Destination could be file or directory. Could have more than one source on single line but Destination must be directory. Similarly to copy command in DOS

24 24 The mv Command Used to move a file from one place to another or to change the name of a file or directory Syntax $ mv [option] [Source] [Destination] Source and Destination could be file or directory. Could have more than one source on single line but Destination must be directory. Similarly to move command in DOS

25 25 The ln Command To create new links (name) between an existing file and a new filename. In the other word, create additional names for an existing file Syntax $ ln [option] [existing file name] [new name]

26 26 The rm command UNIX does not give you any warning message, so think twice before using this command. Syntax $ rm [Existing file names] Similarly to del command in DOS.

27 27 Summary This presentation just show you a few basic command in UNIX. In more advance, I have summary more command and keep them at http://www10.brinkster.com/boyb1917/unix.htm If you want to know more about UNIX, please check that out or register UNIX class on next quadmester and I will see you there. GOOD LUCK !!!!!!!!!!


Download ppt "1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID 121779 COSC 513 Operating System."

Similar presentations


Ads by Google