unix file system

19
UNIX File System UNIX File System by Tero Toikkanen, CAP02S by Tero Toikkanen, CAP02S

Upload: ernie

Post on 11-Jan-2016

25 views

Category:

Documents


0 download

DESCRIPTION

UNIX File System. by Tero Toikkanen, CAP02S. UNIX. Multi-user system Multi-tasking system Wide selection of tools for software development Open architecture. Some UNIX variants. LINUX (Caldera, Debian, Mandrake, RedHat, Slackware, SuSE...). BSD (FreeBSD, NetBSD, OpenBSD). HP-UX. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: UNIX File System

UNIX File SystemUNIX File Systemby Tero Toikkanen, CAP02Sby Tero Toikkanen, CAP02S

Page 2: UNIX File System

UNIXUNIX

• Multi-user systemMulti-user system

• Multi-tasking systemMulti-tasking system

• Wide selection of tools for software Wide selection of tools for software developmentdevelopment

• Open architectureOpen architecture

Page 3: UNIX File System

Some UNIX variantsSome UNIX variants

• LINUX (Caldera, Debian, Mandrake, LINUX (Caldera, Debian, Mandrake, RedHat, Slackware, SuSE...)RedHat, Slackware, SuSE...)

• BSD (FreeBSD, NetBSD, BSD (FreeBSD, NetBSD, OpenBSD)OpenBSD)• HP-HP-UXUX• SolarisSolaris• IRIXIRIX

• Compaq Tru64 UNIX Compaq Tru64 UNIX (discontinued)(discontinued)

Page 4: UNIX File System

KISSKISS

• The general principle: ”Keep It The general principle: ”Keep It Simple, Stupid”Simple, Stupid”

• Programs perform one well defined Programs perform one well defined task properlytask properly

• Almost all data is presented as textAlmost all data is presented as text

• Programs can be combined like Programs can be combined like LEGO-blocksLEGO-blocks

Page 5: UNIX File System

RTFMRTFM

• Learn to use the documentationLearn to use the documentation•manman and and infoinfo commandscommands

• Internet resourcesInternet resources– Website of the variant or distributionWebsite of the variant or distribution– HOW-TO’sHOW-TO’s– TutorialsTutorials

Page 6: UNIX File System

The Basics of UNIX File The Basics of UNIX File systemsystem

• Hierarchical tree -structureHierarchical tree -structure

• File-spesific security rightsFile-spesific security rights

• Files may be sharedFiles may be shared

• Almost everything can be considered to Almost everything can be considered to be a file, so a file can contain anythingbe a file, so a file can contain anything

• Even directories are files, they just Even directories are files, they just contain a list of other filescontain a list of other files

• Case-sensitive file namesCase-sensitive file names

Page 7: UNIX File System

MountingMounting

• All UNIX systems usually have at least one All UNIX systems usually have at least one permanent non-removable hard disk system. permanent non-removable hard disk system. The root directory and the directories below The root directory and the directories below it are stored on this disk. Its structure is it are stored on this disk. Its structure is known as the root file system.known as the root file system.

• If an additional hard disk is added, UNIX If an additional hard disk is added, UNIX creates a separate new filesystem on this creates a separate new filesystem on this disk. Before it can be used, it must be disk. Before it can be used, it must be attached to the root file system. This is attached to the root file system. This is called mounting an additional filesystem.called mounting an additional filesystem.

Page 8: UNIX File System

Mounting example 1Mounting example 1

Page 9: UNIX File System

Mounting example 2Mounting example 2

Filesystem blocks Used Available Mounted onFilesystem blocks Used Available Mounted on

/dev/hda8 995115 598998 344711 //dev/hda8 995115 598998 344711 /

/dev/hda10 2974518 2714151 106547 /usr/dev/hda10 2974518 2714151 106547 /usr

/dev/hda9 995115 174404 769305 /home/dev/hda9 995115 174404 769305 /home

/dev/hda1 52653 2511 47333 /boot/dev/hda1 52653 2511 47333 /boot

/dev/hdb6 3935495 3051510 680363 /scratch/dev/hdb6 3935495 3051510 680363 /scratch

/dev/hdb7 1717427 2076 1626594 /tmp/dev/hdb7 1717427 2076 1626594 /tmp

/dev/fd0 1423 288 1135 /floppy/dev/fd0 1423 288 1135 /floppy

Page 10: UNIX File System

File typesFile types

• A file can be e.g.:A file can be e.g.:– Text fileText file– Data fileData file– Source Code fileSource Code file– Executable fileExecutable file– Shell programShell program– LinkLink– Device fileDevice file

Page 11: UNIX File System

file-commandfile-command• Used to determine file typeUsed to determine file type• Usage:Usage:

– file filefile file

• e.g:e.g:– file *file *– file /dev/hda1file /dev/hda1

• Output examplesOutput examples– ASCII textASCII text– c program textc program text– character specialcharacter special (Device file)(Device file)

Page 12: UNIX File System

cd,lscd,ls- and - and pwdpwd-commands-commands

cdcd

cd ~cd ~

lsls

ls -als -a

ls -lls -l

la -pla -p

pwdpwd

Page 13: UNIX File System

Root-directoryRoot-directory

//

/dev/dev /net/net

/etc/etc /opt/opt

/export/export /sbin/sbin

/home/home /stand/stand

/kernel/kernel /tmp/tmp

/lost+found/lost+found /usr/usr

/mnt/mnt /var/var

Page 14: UNIX File System

Security rightsSecurity rights

Example fileExample file-rwxr-x--- 1 ex1 users 512 Sep 11 10:28 a.ps-rwxr-x--- 1 ex1 users 512 Sep 11 10:28 a.ps

File type indicatiorFile type indicatior| Permissions for file owner| Permissions for file owner| | Permission for group members| | Permission for group members| | | Permissions for others| | | Permissions for others| | | || | | |- rwx r-x ---- rwx r-x ---

Page 15: UNIX File System

File toolsFile tools

• rm - rm - remove file (or directory)remove file (or directory)

• cp - cp - copy file to another locationcopy file to another location

• mv - mv - move file to another locationmove file to another location

• mkdir - mkdir - create new directorycreate new directory

• rmdir - rmdir - remove directoryremove directory

Page 16: UNIX File System

ch-commandsch-commands

• chmodchmod– Change permission mode for fileChange permission mode for file

• chownchown– Change owner for fileChange owner for file

• chgrpchgrp– Change group for fileChange group for file

Page 17: UNIX File System

chmodchmod

• Usage:Usage:– chmod o+r datafileschmod o+r datafiles

chmod [augo][+-=][rwx] filechmod [augo][+-=][rwx] file

Page 18: UNIX File System

catcat and and moremore

•catcat - Display, combine, append, - Display, combine, append, copy, or create filescopy, or create files– Usage:Usage:

cat [option] filecat [option] file

•moremore - Display all or parts of a file - Display all or parts of a file one screen at a timeone screen at a time– Usage:Usage:

more [option] filemore [option] file

Page 19: UNIX File System

More infoMore info

• http://cit.evitech.fi/unix/ostart.htmhttp://cit.evitech.fi/unix/ostart.htm