Unix File System How Unix organizes files and

  • Slides: 11
Download presentation
Unix File System How Unix organizes files and how you can find them.

Unix File System How Unix organizes files and how you can find them.

Unix file system z Home directory y Where your files live. y You always

Unix file system z Home directory y Where your files live. y You always go there when you log in. z Working directory y Whatever directory you are currently in. 2

Typical Unix file system root (/) bin classes cs 290 001 dev csfac ugrad

Typical Unix file system root (/) bin classes cs 290 001 dev csfac ugrad users tmp st fac ms jimd (all people in this class) staff phd usr var spool mail (all users’ mail) etc

Typical Directories z bin: Software for the shell and most common Unix commands. z

Typical Directories z bin: Software for the shell and most common Unix commands. z dev: Short for devices, holds the software necessary to operate peripherals such as printers and terminals. z etc: Contains various administrative files such as lists of user names and passwords. z usr/users: Contains the home directories of users. z tmp: A directory used to hold temporary files. z var: Files that contain information that varies frequently; most commonly, mail directories.

File and Directory Names z Valid names can be made up of: y Uppercase

File and Directory Names z Valid names can be made up of: y Uppercase letters (A to Z) y Lower case letters (a to z) y Numbers (0 to 9) y period (. ), underscore (_), commas (, ). z Should not contain spaces or the following: y& * | [ ] { } $ < > ( ) # ? ‘ “ / ; ^ ! ~ % y You should also avoid naming files or directories with Unix commands.

Absolute Pathnames z To use a file in Unix, all you need is its

Absolute Pathnames z To use a file in Unix, all you need is its name. z To access a file in another directory, you need to know its pathname. z A pathname is an address that shows the file’s position in the file system. z Absolute path names give a files location in relation to the top of the file system structure. z All absolute path names begin with a /. z Also called full path names. z Use the ~ as a shortcut for the full path to a home directory.

Example Directory Structure root (/) bin dev etc home tmp jill jack continents Bats

Example Directory Structure root (/) bin dev etc home tmp jill jack continents Bats oceans bandicoot wombat var usr opossum marsupials kangaroo wombat

Absolute Pathnames z All absolute path names begin with a /. z Also called

Absolute Pathnames z All absolute path names begin with a /. z Also called full path names. z Use the ~ as a shortcut for the full path to a home directory.

Relative path names z Usually you are interested in a files location relative to

Relative path names z Usually you are interested in a files location relative to where you currently are in the system. z A relative pathnames start at the working directory rather than the root. z Use the. . to refer to the parent of the current directory.

Example Directory Structure root (/) bin dev etc home tmp jill jack continents Bats

Example Directory Structure root (/) bin dev etc home tmp jill jack continents Bats oceans bandicoot wombat var usr opossum marsupials kangaroo wombat

Reading z Chapter 6. 1 – 6. 5 z Manipulating Files and Directories

Reading z Chapter 6. 1 – 6. 5 z Manipulating Files and Directories