Tim Hieu File Linux

download Tim Hieu File Linux

of 41

Transcript of Tim Hieu File Linux

  • 8/3/2019 Tim Hieu File Linux

    1/41

    Click to edit Master subtitlestyle

    OVERVIEW OFFILESYSTEMMANAGEMENT IN LINUX

    Lecturer:MS. V Minh Sn

    Students:Nguyn c Tin 0620076Nguyn Xun Thun 0620069

  • 8/3/2019 Tim Hieu File Linux

    2/41

    Filesystem management in Linux

    CONTENTS

    filesystem management in Linux22

    Demo

    4

    Exploring the Linux filesystem1

    File permissions

    2

    File processing

    3

    5

    Q & A 6

    Examining Files

  • 8/3/2019 Tim Hieu File Linux

    3/41

    Filesystem management in Linux

    1.1 Exploring the Linux

    filesystem1.1 Overview

    1.2 Filesystem hierarchy

    1.3 Type of information

    1.4 Linux device files

    1.5 Mounting and unmounting a device onthe

    filesystem filesystem management in Linux33

  • 8/3/2019 Tim Hieu File Linux

    4/41

  • 8/3/2019 Tim Hieu File Linux

    5/41

    Filesystem management in Linux

    1.1 Overview (cont)

    filesystem management in Linux55

  • 8/3/2019 Tim Hieu File Linux

    6/41

    Filesystem management in Linux

    1.1 Overview (cont)

    l File properties (Administrativeinformation)

    66 Filesystem management in Linux

    l Namel Locationl Sizel Owner/Groupl Type

    l Data created/accessed/modified

    l Permissionsl Desktopl Command line

    files inodel File manager KDE Konqueror(Windows Explorer) GNOME Nautilus

  • 8/3/2019 Tim Hieu File Linux

    7/41Filesystem management in Linux

    1.2 Filesystem hierarchy

    77 filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    8/41Filesystem management in Linux

    1.1 Understanding the

    filesystem hierarchy (cont)

    filesystem management in Linux88

  • 8/3/2019 Tim Hieu File Linux

    9/41Filesystem management in Linux

    1.2 Filesystem hierarchy (cont)

    l path (pathname) absolute name vs relative name

    /home/nguyenxuanthuan/programs /home/guest/programsl shorcut

    . current directory .. directory immediately above the

    current directory

    Filesystem management in Linux99

  • 8/3/2019 Tim Hieu File Linux

    10/41

    Filesystem management in Linux

    1.3 Type of information

    Filesystem management in Linux1010

    Data files

    Link files

    Directory files

    Configuration files

    Device files

    Type ofinformation

    Application-specific fileso Program

    Applicationso Image files

    Text files

  • 8/3/2019 Tim Hieu File Linux

    11/41

    Filesystem management in Linux

    1.4 Linux device files

    filesystem management in Linux1111

  • 8/3/2019 Tim Hieu File Linux

    12/41

    Filesystem management in Linux

    1.4 Linux device files (cont)

    l Linux treats all devices as files and usesa device just as it uses a file

    Filesystem management in Linux1212

    Open file Write fileRead fileClose file

    l Device Driver : a special program thatcontrols a particular type of hardware

    l Any application can access a device byopening the file specific to that device

  • 8/3/2019 Tim Hieu File Linux

    13/41

    Filesystem management in Linux

    1.4 Linux device files (cont)

    l Device file : the file which applications useto access a device

    These special appear in the /dev directory in theLinux filesystem block devices b

    character devices c

    network devices eth x/ppp x(x = 0, 1, ...)

    Filesystem management in Linux1313

  • 8/3/2019 Tim Hieu File Linux

    14/41

    Filesystem management in Linux

    1.5 Mounting and unmounting a

    device on the filesysteml Each of storage device has own filesystem

    when you want to add a new storage device, you need toformat it as a filesystem and then attach it to your Linux filestructure

    l Mounting is the operation you perform tocause the filesystem on a physical storagedevice to appear as part of the Linuxfilesystem

    l Mounting point is a specified directory thatcontains the mount command to mount a

    device on the Linux filesystemFilesystem management in Linux1414

  • 8/3/2019 Tim Hieu File Linux

    15/41

    Filesystem management in Linuxfilesystem management in Linux1515

    Mounting adevice on

    thefilesystem

  • 8/3/2019 Tim Hieu File Linux

    16/41

    Filesystem management in Linux

    How to name a storage in Linux

    Filesystem management in Linux1616

    l Example fd 0: the first floppy drive attached to your system sd a 2: the second partition on the first SCSI hard drive

    hd IDE hard drive1 4 are primary partitions5 and up are logical partitions

    sd SCSI hard drives

    fd Floppy diskslp Printer portscdrom Links to your CD-ROM device file

  • 8/3/2019 Tim Hieu File Linux

    17/41

    Filesystem management in Linux

    2. Examining Files

    File information

    GUI: right-click the file icon andselect properties .

    Command line: ls options: -l, -a operators: >,>> pwd

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    18/41

    Filesystem management in LinuxFilesystem management in Linux1818

  • 8/3/2019 Tim Hieu File Linux

    19/41

    Filesystem management in Linux

    3. File Permissions

    l Three types of user accounts O w n e r The account that owns the file G r o u p Members of a group that owns the file

    A l l u s e r s All accounts on the systeml Do one or more of three things tothe file

    R e a d ( r ) Look at the contents of the file Wr i t e ( w ) Save the file to the hard disk E x e c u t e ( x ) Run the file or enter the directory

    l Example: drwxr-xr--

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    20/41

    Filesystem management in Linux

    3. File Permissions (cont)

    Format:chmod who action permission filename

    Example: chmod u+x nguyen.txtFilesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    21/41

    Filesystem management in Linux

    4. File processing

    4.1 Finding file

    4.2 Creating Directories, Files, and Links

    4.3 Copying, Renaming, and Moving Files

    4.4 Viewing and Editing Text Files

    4.5 Deleting Files and Directories4.6 Backup and restoring files

    Filesystem management in Linux

    http://var/www/apps/conversion/current/tmp/scratch16264/slide33.xml
  • 8/3/2019 Tim Hieu File Linux

    22/41

    Filesystem management in Linux

    4.1 Fin ding file

    l Use: find command to find files by filename or

    prop erties and grep command to find files by content

    Filesystem management in Linux

    http://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide33.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide32.xml
  • 8/3/2019 Tim Hieu File Linux

    23/41

    Filesystem management in Linux

    4.1.1 Find command

    find pathname conditions

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    24/41

    Filesystem management in Linux

    4.1.2 Grep command

    grep options pattern files

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    25/41

    Filesystem management in Linux

    4.2 Creating Directories, Files, andLinks

    v To create a directory in any directory whereyou have write permission, use the mkdir command:

    mkdir path/dirname v If path includes directories don't yet exist,

    you can create them in one command withthe -p option :

    mkdir -p /usr/local/newparent/mydir

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    26/41

    Filesystem management in Linux

    4.2 Creating Directories, Files, andLinks (cont)

    l Files can be created by applications, such asa word processor, and cat command.

    l

    Links can be created at the command lineusing the ln command

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    27/41

    Filesystem management in Linux

    4.3 Copying, Renaming, andMoving Files

    v To copy or move a file, type:+ cp path/sourcename path/targetname

    (copies a file)+ cp -r path/sourcename pa th/targetname(copies a directory)

    + mv path/sourcename path/targetname (moves a file or directory)v Your account needs to have write permissions

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    28/41

    Filesystem management in Linux

    4.4 Viewing and Edi ting Text Files

    l Applications: Kate, Kwrite, l Command lines:

    cat filename: The entire file contents displayon the screen at once

    less filename: display the contents one screenat a time

    vi filename: edit file

    Filesystem management in Linux

    http://var/www/apps/conversion/current/tmp/scratch16264/slide38.xmlhttp://var/www/apps/conversion/current/tmp/scratch16264/slide38.xml
  • 8/3/2019 Tim Hieu File Linux

    29/41

    Filesystem management in Linux

    Vi options

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    30/41

    Filesystem management in Linux

    Vi options (cont)

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    31/41

    Filesystem management in Linux

    Vi options (cont)

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    32/41

    Filesystem management in Linux

    ZZ: save file:q!: close without saving file

    Vi options (cont)

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    33/41

    Filesystem management in Linux

    4.5 Deleting Files and Directories

    l rm filename: delete a filel rm *: delete all file in current directory

    l rmdir dirname: remove a empty directoryl rm -r dirname: remove a directoryl Must have write permissions on the directory

    containing the files

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    34/41

    Filesystem management in Linux

    4.6 Backup and Restoring files

    l +which files needing to backup

    +how often+what back up storage touse

    Filesystem management in Linux3434

    Back up strategyBack up media

    l tap archiver command (tar)l Format: tar options tarfile filelist

  • 8/3/2019 Tim Hieu File Linux

    35/41

    Filesystem management in Linux

    Tar options

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    36/41

    Filesystem management in Linux

    Tar options (cont)

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    37/41

    Filesystem management in Linux

    Tar options (cont)

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    38/41

    Filesystem management in Linux

    Tar options (cont)

    Filesystem management in Linux

  • 8/3/2019 Tim Hieu File Linux

    39/41

    Filesystem management in Linux

    5. DEMO

    l VMWare Workstation Version 6.0.0 build-45731

    l

    Linux OS Distribution Tinycorel Demo

    Filesystem management in Linux3939

  • 8/3/2019 Tim Hieu File Linux

    40/41

    Filesystem management in Linux

    Reference

    1. Spring into Linux (AW), 20052. Linux All-In-One Desk Reference For

    Dummies 2e (Wiley, 2006)3. Beginning Linux Programming 4e(Wrox, 2007)

    4. Linux: The Complete Reference, SixthEdition

    5. www.tinycore.com

    Filesystem management in Linux4040

  • 8/3/2019 Tim Hieu File Linux

    41/41

    6. Q&A

    Thank You !