unix file system

Post on 11-Jan-2016

25 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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

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

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

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)

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

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

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

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.

Mounting example 1Mounting example 1

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

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

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)

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

cdcd

cd ~cd ~

lsls

ls -als -a

ls -lls -l

la -pla -p

pwdpwd

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

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 ---

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

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

chmodchmod

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

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

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

More infoMore info

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

top related