The File System - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

The File System

Description:

Absolute pathname. Uses the root (/) directory as reference. Independent of current ... Relative pathname. Uses the current directory (pwd) as reference point. ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 18
Provided by: marthas
Category:
Tags: file | pathname | system

less

Transcript and Presenter's Notes

Title: The File System


1
The File System
  • Chapter 6 in your Textbook

2
Files in UNIX
  • No restriction on type of information stored in
    them
  • Everything is a file in UNIX
  • Extensions are not enforced (.exe, .doc, etc)
    they are just a convenience
  • Use file or type commands for this

3
Everything is a file
  • Ordinary (regular) files
  • Stream of characters (data, source code,
    executable, commands)
  • Directory files
  • Contain names and inode numbers of the files in
    the directory
  • Device files
  • Filenames are associated with physical devices

4
Filenames
  • Up to 255 characters long
  • Valid characters are
  • Numbers and letters
  • Period (.)
  • Hyphen (-)
  • Underscore (_)
  • Avoid control characters

5
pwd commandknowing your current directory
/ (root)
home
  • pwd
  • /home/joe

joe
6
Creating directories and filesmkdir and touch
/ (root)
home
1
  • pwd
  • /home/joe

joe
2
dir
file
mkdir dir
3
touch file
7
Removing files withrm
/ (root)
home
joe
dir
4
rm file
8
cd to directories and coming HOME (without
arguments)
/ (root)
5
  • pwd
  • /home/joe
  • cd dir

home
joe
6
pwd /home/joe/dir
dir
7
cd pwd /home/joe
9
Absolute pathname
  • Uses the root (/) directory as reference
  • Independent of current directory
  • Note that this path always starts with /

10
Absolute pathname
/ (root)
1
  • cd /home/joe
  • pwd
  • /home/joe

home
joe
2
cd /home/joe/dir pwd /home/joe/dir
dir
11
Relative pathname
  • Uses the current directory (pwd) as reference
    point
  • . (single dot)- references current directory
  • ..(two dots) - references parent directory
  • dir-name references a child directory by the
    name dir-name

12
Relative pathname
/ (root)
1
home
pwd /home/joe
2
joe
cd ./dir pwd /home/joe/dir
dir
cd .. pwd /home/joe
3
13
mkdir command
  • Can take one or more arguments
  • mkdir sales
  • mkdir docs pay
  • Use the -p option if progs doesnt already exist
  • mkdir -p progs/java

joe
sales
dir
progs
pay
docs
java
14
rmdir command
  • Removes existing empty directories
  • rmdir sales pay
  • Use rm -r option if not empty (be careful!)
  • rm -r progs

joe
docs
dir
15
mv command
  • Renaming one file
  • mv f1 f2
  • Moving one file to a directory
  • mv f1 dir
  • Careful, you can rename f1 to dir
  • Moving more than one file to a directory
  • mv f1 f2 f3 f4 dir
  • dir must be an existing directory

16
df vs. du
  • df outputs the total disks usage (Sys Admin)
  • du is a command to output users individual disk
    consumption (in blocks)
  • du .
  • 320 ./cgi-bin
  • 160 ./cs3375/img
  • 1376 ./cs3375
  • 464 ./cs1315

17
Compression utilities
Write a Comment
User Comments (0)
About PowerShow.com