Unix file system - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Unix file system

Description:

opossum. wombat. 6. Absolute pathnames. All absolute path names begin with a ... opossum. wombat. 9. ls. list. Displays all files in the current working ... – PowerPoint PPT presentation

Number of Views:400
Avg rating:3.0/5.0
Slides: 15
Provided by: multimedia1
Category:
Tags: file | opossum | system | unix

less

Transcript and Presenter's Notes

Title: Unix file system


1
Unix file system
  • Home directory
  • A directory set aside for your personal use
  • The starting point when you log in
  • Working directory
  • Whatever directory you are currently in
  • Initially, the working directory is the home
    directory
  • The cd command is used to change the working
    directory

2
Typical Unix file system
root (/)
bin
dev
tmp
usr
var
users
classes
csfac
st
fac
staff
spool
mail
ugrad
ms
phd
cs201
801
(all users mail)
3
File and directory names
  • Valid names can be made up of
  • Uppercase letters (A to Z)
  • Lower case letters (a to z)
  • Numbers (0 to 9)
  • period (.), underscore (_), commas (,)
  • Should not contain spaces or the following
  • \ lt gt ( ) ? / !
  • You should also avoid naming files or directories
    with Unix commands

4
Absolute pathnames
  • To use a file in Unix, all you need is its name
  • To access a file in another directory, you need
    to know its pathname
  • A pathname is an address that shows the files
    position in the file system
  • Absolute path names give a files location in
    relation to the top of the file system structure
  • The command pwd displays the absolute path of the
    current working directory

5
Example directory structure
root (/)
bin
etc
var
tmp
dev
home
usr
jill
jack
marsupials
Bats
continents
oceans
kangaroo
wombat
bandicoot
opossum
wombat
6
Absolute pathnames
  • All absolute path names begin with a /
  • Also called full path names
  • Use the as a shortcut for the full path to your
    home directory

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

8
Example directory structure
root (/)
bin
etc
var
tmp
dev
home
usr
jill
jack
marsupials
Bats
continents
oceans
kangaroo
wombat
bandicoot
opossum
wombat
9
ls
  • list
  • Displays all files in the current working
    directory
  • Flags
  • -a shows all the files, including hidden ones
  • -F puts a / after directories, an after
    executables, and an _at_ after links
  • -l displays a long listing of files
  • -R will also list contents of sub-directories
  • -s will list the size of the files

10
Viewing the file
  • What if you want to see the contents of a file?
  • Use the cat command
  • cat name of file
  • cat snapshot06302005
  • Use the more command
  • more name of file
  • more snapshot06302005

11
cp
  • Copies the contents of one file to another
  • cp file to copy new file name
  • Flags
  • -r will copy directories and all their contents
  • Without this flag, the directory will not be
    copied and you will get an error message

12
mv
  • Better name could be the rename command
  • Changes the name of one file to another
  • mv old file name new file name
  • Note, if new file name is a directory, you will
    move old file name to that directory and keep
    the original name

13
rm
  • remove
  • Deletes the specified file or files
  • This is destructive!
  • They are gone!
  • They cannot be retrieved!
  • rm file name
  • rm does not work with directories
  • unless the r Flag is used

14
Creating files directories
  • The command to create a directory is mkdir
  • grid1 mkdir lab1
  • To create a new text file, you can use pico or
    emacs
  • You will learn more about text editors in lab
Write a Comment
User Comments (0)
About PowerShow.com