Learn GNULinux Part 2 6 Inch

Embed Size (px)

Citation preview

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    1/251

    1

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    2/251

    2

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    3/251

    GNU/Linux

    2

    .

    GNU/Linux 2 Copyright 2014 by

    Creative Commons Attribution-ShareAlike3.0 Unported.

    3

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    4/251

    GNU/Linux 2

    Main Body

    Linux-

    Users-

    Disk Management

    Mount Unmount

    Process Management

    4

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    5/251

    Shell Programming

    Shell Script- 2

    Shell Scripting 3

    Job Scheduling

    Rsync backup

    5

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    6/251

    GNU/Linux

    2

    6

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    7/251

    7

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    8/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    9/251

    .

    .

    , ,

    www.kaniyam.com

    .

    .

    .

    : .

    : http://FreeTamilEbooks.com

    Creative Commons Attribution-ShareAlike4.0

    International License. 9

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    10/251

    .

    . ,

    .

    10

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    11/251

    .

    ,

    . ,

    .

    ,

    MySQL-

    . ,

    11

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    12/251

    .

    .

    ,

    .

    .

    ,

    GNU/Linux-

    . ,

    ,

    .

    1 , GNU/Linux12

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    13/251

    - 2

    , .

    .

    .

    ,292013

    :

    [email protected]

    : http://nithyashrinivasan.wordpress.com

    13

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    14/251

    GNU/Linux

    .

    14

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    15/251

    30, 2013 , .

    : . .., , , ( )

    : ., 2004- ,

    . ( )

    15

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    16/251

    , ,

    - , ... 100 (6500 ).

    16

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    17/251

    , MySQL 5000 .

    : http://jasanpictures.com

    CreativeCommons

    17

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    18/251

    .

    .

    Name NithyaDuraisamy

    ICICI 006101540799

    Branch Mcitybranch, chengalpattu.

    IFSCcode ICIC0000061

    18

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    19/251

    Linux-

    , Linux

    .

    .

    Linux 20-

    70- . 1969-

    AT&T subsidiary-

    Bell Laboratories Unix 19

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    20/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    21/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    22/251

    unix- source code-

    .

    .

    Stallman- .

    source code

    source code-

    .

    Stallman- .

    .22

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    23/251

    1983- Stallman

    GNU.

    .

    Stallman :

    ========

    , 27, 1983 12:35:59 EST

    GNU(GNU is Not Unix) Unix compatible

    software system-

    .

    , ,23

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    24/251

    .

    GNU kernel C Programs-

    utilities-

    . editor, shell, C Compiler, linker,

    assembler .

    text editor, a YACC, an Empire game,

    spreadsheet applications-

    .

    online hardcopy

    documentation- .

    GNU- unix . 24

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    25/251

    unix- .

    .

    ==========

    .

    GNU GNU is Not Unix . Unix

    .

    .

    unix- windows-25

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    26/251

    . , Stallman

    Manifest GNU GPL

    (General Public License)

    .

    GPL-

    ()

    .

    (Freedom#0)

    ,

    (Freedom#1)26

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    27/251

    (Freedom#2)

    Program- ,

    programs-

    (Freedom#3).

    .

    .

    GPL .

    27

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    28/251

    ,

    .

    1990- GNU

    components . Emacs text editor,

    Compiler gcc, GNU C Compiler debugger gdb

    stallman .

    compiler

    ,

    . compilers,

    C++, Pascal Fortran

    . GCC28

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    29/251

    GNU Compiler Collection .

    Richard Stallman- 1990- GNU

    System- .

    component- kernel

    . kernel- (GNU Hurd

    ) Mach- set of

    server process- implement

    . Mach Carnegie Mellon

    Utah

    micro kernel.

    kernel .

    29

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    30/251

    Minix:

    1990- Intel Microprocessor-,

    Microsoft-

    . Microsoft desktop

    , server

    . Intel Intel compatible processors-

    , unix-

    workstations- .

    unix based system- versions,

    Intel- .

    30

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    31/251

    Unix-

    processors- (eg: SGI& MIPS)

    .

    Unix- Intel Processor-

    OS. 1987- Andrew

    Tanenbaum Minix OS-. Netherlands- , Amsterdam

    31

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    32/251

    Vrije University-

    .

    Minix- OS-

    .

    OS

    . C Assembly

    language- 12,000

    .

    Tanenbaum- Operating

    Systems: Design and Implementation

    Minix

    .

    Linus Torvalds Minix- 32

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    33/251

    Linux- .

    Linux:

    1991- Linus Benedict Torvalds

    Finland, Intel Processor-

    Unix

    kernel- .

    Minix prototype-

    .

    Minix-

    kernel- GPL

    . Linus Torvalds33

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    34/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    35/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    36/251

    .

    . GNU

    .

    .

    Minix- .

    Minix-

    .

    .

    .

    bash(1.08) gcc(1.40)- port36

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    37/251

    . .

    [email protected]

    .

    ================

    .

    Torvalds Freax

    kernel/makefile0.11-

    programs- .

    Ari lemmke FTP site- system-

    load directory- pub/OS/Linux

    . Linux 37

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    38/251

    OS- .

    1991- Torvalds -

    .

    Torvalds-

    .

    1992- Linux-

    ,

    .

    Torvalds- . Torvalds38

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    39/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    40/251

    Linux GNU GNU/Linux

    Distribution .

    Red Hat, Caldera

    . Debian

    distribution.

    X-windows system, KDE, GNOME GUI-

    distributions-

    .

    Torvalds

    . version0.01- acknowledgement copyrights-

    . , 40

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    41/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    42/251

    GNU/Linux-

    . GCC Compiler- linux

    .

    GPL .

    Torvalds version0.12- GPL

    .

    GNU/Linux

    GNU/Linux-

    .

    GNU/Linux

    .

    42

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    43/251

    Users-

    user management-

    commands- .

    root ?

    Ubuntu- install

    root

    account- .

    root- disable

    43

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    44/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    45/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    46/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    47/251

    $ adduserharini

    , harini

    user.

    47

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    48/251

    users

    /etc/passwd .

    harini

    user

    .

    48

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    49/251

    $ cat/etc/passwd

    password x

    . /etc/shadow

    users- encrypt password-

    . .

    $ sudocat/etc/shadow

    49

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    50/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    51/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    52/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    53/251

    arrow mark key- sudo- entry

    . sudo- entry

    comma-

    harini type ctrl+O

    . file- overwrite

    . 53

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    54/251

    harini- sudo

    chowncommand

    chown command- file- owner- 54

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    55/251

    . LKG file- user, Nithya

    . Harini

    , command- .

    $ chownhariniLKG

    55

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    56/251

    chgrpcommand

    chgrp command- file- group-

    . LKG file- group,

    Nithya . Harini

    , command- .

    $ chgrphariniLKG

    56

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    57/251

    owner group-

    chmod command owner57

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    58/251

    group-

    .

    $ chmodnithya:shriniLKG

    owner- nithya-, group- shrini- 58

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    59/251

    . colon-

    dot- .

    userdelCommand

    userdel command- user- .

    $ userdelharini

    59

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    60/251

    PasswordPolicy:

    password

    .

    . password

    4 ,

    entropy checks- .

    /etc/pam.d60

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    61/251

    /common-password file-

    .

    password :

    user

    - , password-

    61

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    62/251

    .

    password-

    .

    password-

    command.

    $ sudochage-lshrini

    62

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    63/251

    command-

    .

    $ sudochageshrini

    63

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    64/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    65/251

    groups-

    command.

    groups

    groups- .

    $ cat/etc/group

    65

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    66/251

    groups-

    command.

    $ groupsshrini

    group-

    commands.

    $ sudoaddgroupclg66

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    67/251

    $ sudodelgroupclg

    clg group,

    .

    group- :

    67

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    68/251

    $ sudodelgrouponly-if-emptygroup

    user- group- :

    $ sudousermod-Ggroup-auser

    68

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    69/251

    User :

    user- backup.

    $ sudodeluserbackup-to/location/to/put/backup/user

    remove-homeuser

    69

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    70/251

    User-

    user- home directory

    $ sudodeluserremove-homeuser

    70

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    71/251

    user, home directory user- ownership

    file-

    $ sudodeluserremove-all-filesuser

    Group-

    user- Group- .

    71

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    72/251

    $ iduser

    /etc/passwdfile

    /etc/passwd text

    file . file-

    . root . 72

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    73/251

    system user human user

    .

    /etc/passwd- :

    .

    file

    - : . 7 .

    73

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    74/251

    username: 1.

    password: . x

    . /etc/shadow file-

    .

    2.

    User id(UID) : user id

    ( ) . 0 root-

    . 1-999 system user-

    3.

    74

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    75/251

    human user- .

    Group id(GID) : ,

    (Primary group id/etc/group) - .

    4.

    User Id info: .

    . , ,

    . finger

    .

    5.

    home directory: home directory().6. 75

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    76/251

    .

    command/ shell: login

    command shell

    /bin/bash. command

    .

    7.

    $ less/etc/passwd

    76

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    77/251

    $ grepnithya/etc/passwd

    /etc/shadowfile:

    /etc/passwd- .

    /etc/shadow file- .

    77

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    78/251

    encryption

    . root

    . :

    .

    Username: 1.

    Password: ( encryption)2. 78

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    79/251

    last password change: Jan1, 1970

    3.

    Minimum:

    . .

    4.

    Maximum:

    .

    .

    5.

    79

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    80/251

    Warn: 6.

    Inactive: ,

    7.

    expire: 8.

    md5 algorithm

    encryption .

    80

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    81/251

    DiskManagement

    Hard disk .

    /dev/sda: Primary Master

    /dev/sdb: Primary slave

    /dev/sdc: Secondary Master

    /dev/sdd: Secondary slave 81

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    82/251

    hard disk- /dev/sda.

    partition .

    /dev/sda1

    /dev/sda2

    /dev/sda3

    /dev/sda4

    82

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    83/251

    4 primary partition .

    4 extended , logical

    partition- .

    fdisk , partition-

    .

    83

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    84/251

    : . root

    .

    , .

    , .

    .

    Partition- :

    partition-

    84

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    85/251

    $ sudofdisk-l

    85

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    86/251

    disk- partition-

    1.

    $ sudofdisk-l/dev/sda

    fdisk- :

    , partition

    . . m

    # fdisk /dev/sda86

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    87/251

    The number of cylinders for this disk is set to9729.

    There is nothing wrong with that, but this is larger

    and could in certain setups cause problems with:

    1) software that runs at boot time(e.g., old versions o

    2) booting and partitioning software from other OSs

    (e.g., DOS FDISK, OS/2 FDISK)

    Command(mforhelp): m

    Command action

    a toggle a bootable flag

    b edit bsd disklabel

    c toggle the dos compatibility flag

    d delete a partition

    l list known partition types

    m print this menu

    n add a new partition

    87

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    88/251

    o create a new empty DOS partition table

    p print the partition table

    q quit without saving changes

    s create a new empty Sun disklabel

    t change a partition's system id

    u change display/entry units

    v verify the partition table

    w write table to disk and exit

    x extra functionality(experts only)

    partition- 1.

    # fdisk/dev/sda

    The number of cylinders for this disk is set to9729.88

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    89/251

    There is nothing wrong with that, but this is larger

    and could in certain setups cause problems with:

    1) software that runs at boot time(e.g., old versions o

    2) booting and partitioning software from other OSs

    (e.g., DOS FDISK, OS/2 FDISK)

    Command(m for help): p

    Disk/dev/sda: 80.0 GB, 80026361856 bytes

    255 heads, 63 sectors/track, 9729 cylinders

    Units= cylinders of16065 * 512 = 8225280 bytes

    Disk identifier: 0xf6edf6ed

    Device Boot Start End Blocks Id System

    /dev/sda1 1 1959 15735636 c W95 FAT32 (LBA)

    /dev/sda2 1960 5283 26700030 f W95 Ext'd(LBA)

    89

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    90/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    91/251

    Command(m for help): w

    The partition table has been altered!

    Calling ioctl() to re-read partition table.

    WARNING: Re-reading the partition table failed with

    The kernel still uses the old table. The new table wil

    the next reboot or after you run partprobe(8) or kpar

    Syncing disks.

    partition- 3.

    91

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    92/251

    partition- ,

    cylinder, partition- ()

    cylinder .

    p, print.

    #fdisk

    /dev

    /sda

    The number of cylinders for this disk is set to9729.

    There is nothing wrong with that, but this is larger

    and could in certain setups cause problems with:1) software that runs at boot time(e.g., old versions o

    2) booting and partitioning software from other OSs

    (e.g., DOS FDISK, OS/2 FDISK)

    Command(mforhelp): n

    First cylinder(2662-5283, default2662):92

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    93/251

    Using default value2662

    Last cylinder, +cylinders or+size{K,M,G} (2662-3264, de

    Using default value3264

    w .

    Command(

    m for help):

    w

    The partition table has been altered!

    Calling ioctl() to re-read partition table.

    WARNING: Re-reading the partition table failed with

    The kernel still uses the old table. The new table wil

    the next reboot or after you run partprobe(8) or kpar

    Syncing disks.

    mkfs format.93

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    94/251

    # mkfs.ext3 /dev/sda7

    boot flag-

    partition- boot a

    . .

    4.

    # fdisk/dev/sda

    The number of cylinders for this disk is set to9729.

    There is nothing wrong with that, but this is larger

    and could in certain setups cause problems with:

    1) software that runs at boot time(e.g., old versions o

    2) booting and partitioning software from other OSs

    (e.g., DOS FDISK, OS/2 FDISK)94

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    95/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    96/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    97/251

    /dev/sda3 5284 6528 10000462+ 7 HPFS/NTFS

    /dev/sda4 6529 9729 25712032+ c W95 FAT32 (LBA)

    /dev/sda5 1960 2661 5638752 83 Linux

    /dev/sda6 3265 5283 16217586 b W95 FAT32

    /dev/sda7 2662 3264 4843566 83 Linux

    Partition table entries are not in disk order

    Command(m for help):

    partition order-

    logical partition- ,

    4.

    97

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    98/251

    ,

    . Partition out of order. Partition table

    entries are not in disk order.

    Sda6, sda7, sda8 .

    sda6 , sda7

    . sda9 , sda6

    . f.

    .

    98

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    99/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    100/251

    Device Boot Start End Blocks Id System

    /dev/sda1 1 1959 15735636 c W95 FAT32 (LBA)

    /dev/sda2 1960 5283 26700030 f W95 Ext'd(LBA)

    /dev/sda3 5284 6528 10000462+ 7 HPFS/NTFS

    /dev/sda4 6529 9729 25712032+ c W95 FAT32 (LBA)

    /dev/sda5 * 1960 2661 5638752 83 Linux

    /dev/sda6 3265 5283 16217586 b W95 FAT32

    /dev/sda7 2662 3264 4843566 83 Linux

    Partitiontableentriesarenotindiskorder

    Command(m for help): x

    Expertcommand(mforhelp): f

    Done.

    100

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    101/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    102/251

    Mount Unmount

    Partition-

    .

    file system

    . ext3, ext4, ReiserFS, Btrfs

    / filesystems.

    102

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    103/251

    Journalins Filesystem

    .

    index ,

    file index.

    , , hard disk-

    .

    mkfs file system.

    sudomkfs

    .ext

    4 /dev

    /sda

    5

    sudomkfs.reiserf5 /dev/sda6103

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    104/251

    file system

    mount .

    mount raw- device/partition

    /

    folder .

    Mount disk partition, Linux network share, windows

    network share, iso file cd/dvd

    folder .104

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    105/251

    Mount- :

    root sudo

    .

    1:

    sudomount/dev/sda5 /songs

    105

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    106/251

    /dev/sda5 /songs- mount

    . ls/songs cd/songs

    /dev/sda5 file- .

    2:

    sudomount-tiso9660 movie.iso/media/movie106

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    107/251

    movie.iso ISO file- /media/movie

    folder- mount.

    folder- mount. mount

    point.

    mount filesystem-

    , mount .

    Unmount:

    107

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    108/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    109/251

    /etc/fstab

    boot filesystem-

    mountpoint- mount . /etc/fstab

    file .

    6 column .

    filesystem.

    109

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    110/251

    Filesystem:110

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    111/251

    filesystem:

    ext3/ext4 : / file system

    iso9660 : iso file

    proc: proc virtual file

    system

    vfat: fat16, fat32 file system

    auto: filesystem

    nts: network file system 111

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    112/251

    smbfs: network file system

    MountOptions:

    Mount -o , .

    /etc/fstab- .

    noauto: boot mount

    112

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    113/251

    . cd/dvd .

    ro: Read-Only mount

    users: root mount()

    unmount.

    user: , mount

    unmount

    /etc/fstab- 5 column, dump.

    dump

    ,restore

    backup

    . filesystem 1 ,

    cd/dvd/usb removable media- 0 113

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    114/251

    .

    6 column- pass-no. boot

    file system check

    .

    root/ 1

    boot- mount file system- 0

    file system- 2

    file- mount:114

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    115/251

    iso file file- device mount

    .

    1.44 MB file .

    ddif=/dev/zeroof=disk.imgbs=1024 count=1400

    dd= disk dump

    115

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    116/251

    if= input file

    of= output file

    bs= block size

    count= count of dump operation

    file-

    .

    file system back level copy

    .116

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    117/251

    ddif=/dev/sdb1 of=usb.img

    mount-oloopusb.img/mnt/disk

    117

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    118/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    119/251

    df

    disk space- , . Mount

    point .

    df-h

    119

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    120/251

    -h human readable

    MB, GB .

    folder- :

    120

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    121/251

    du

    folder- .

    du-h

    du-sh

    121

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    122/251

    filesystem- repair:

    , ,

    , filesystem

    .

    Hardware

    .

    .

    122

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    123/251

    fsck

    sudofsck/dev/sda5

    .

    sudofsck-y-f/dev/sda5 123

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    124/251

    -y= yes for questions

    -f= force

    fdisk file system unmount

    .

    124

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    125/251

    ProcessManagement

    process.

    parent process child process

    . init

    process. process- pid

    refer.

    125

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    126/251

    pscommand

    ps command-

    process-

    .

    ps

    126

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    127/251

    psax, ps-aux, ps-ef, ps-l

    .

    pstreecommand

    pstree command-

    process-, parent process

    child process- tree 127

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    128/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    129/251

    topcommand

    top command- process

    process-

    . output- real time

    monitoring

    .

    $ top

    129

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    130/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    131/251

    process-

    . process-

    signal-

    $ kill2180

    screenshot-

    terminal- pid2180 . kill

    2180 , terminal

    .

    131

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    132/251

    killall

    , program , kill

    .

    132

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    133/251

    synaptic, software center

    GUI ,

    command- .

    Apt

    133

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    134/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    135/251

    ubuntu APT, Arch linux- pacman

    .

    :

    sudoapt-cachesearch[searchterm1] [searchterm2]

    [searchtermn]

    135

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    136/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    137/251

    . ,

    .

    debian, ubuntu- /etc/apt/sources.list repository

    .

    repo-

    sudoadd-apt-repository[repositorynamehere]

    137

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    138/251

    sudoadd-apt-repositoryppa:tualatrix/ppa

    Source- :

    repo- repo

    .

    sudoapt-getupdate

    138

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    139/251

    :

    :

    139

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    140/251

    sudoapt-getinstall[packagename1] [packagename

    2] [packagenamen]

    ,

    repository-

    .

    140

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    141/251

    :

    141

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    142/251

    sudoapt-getremove[packagename1] [packagename

    2] [packagenamen]

    configuration file

    directory purge.

    142

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    143/251

    sudoapt-getremovepurge

    upgrade:

    sudoapt-getupgrade

    143

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    144/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    145/251

    .

    :

    repo- deb file-

    .

    sudoapt-getclean

    145

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    146/251

    :

    sudodpkglist

    ,

    .

    Debfile :

    146

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    147/251

    debian/ubuntu packages deb

    .

    , .

    sudodpkg-i

    147

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    148/251

    ShellProgramming

    , shell-

    ,

    program- .

    shell- programming language-

    . programming language-

    programming constructs, logical conditional

    operators, command substitution, escape mechanisms,148

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    149/251

    positional parameters

    shell-

    .

    ShellScript-

    unix-

    commands- .

    commands

    shell script .

    date, ls, uname, echo

    unix commands- example1 file-

    149

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    150/251

    . .

    example1 shell script

    . script-

    , output- .

    150

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    151/251

    ShellScript-

    shell script-

    .

    1: sh unix command- script file-

    argument- shell script-

    . .

    example1 shell script-

    unix commands-

    output- .151

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    152/251

    2: chmod unix command

    file execute

    permission- script file-

    execute. .

    Variables

    Unix-, variables-, local variables

    global variable .

    .

    GlobalVariables

    152

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    153/251

    Global Variables

    unix ,

    . environment variables

    .

    PATH variable-

    directory- .

    PS1 variable- shell prompt-

    , HOME variable-

    home directory-

    .

    $ (dollar) variables-

    , 153

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    154/251

    .

    $ $PATH

    $ $PS1

    $ $HOME

    154

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    155/251

    LocalVariables

    shell environment-

    variable- local variable. shell

    environment- ,

    . shell

    variables .

    localvariable- :

    a,b 2 variable- shell

    environment- .

    155

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    156/251

    variables- echo .

    .

    variables- shell

    script- , .

    156

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    157/251

    variables.

    local variables shell environment-

    shell variables.

    global variables- ,

    .

    environment- shell variables

    157

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    158/251

    set

    command- .

    $ set

    Localvariables- Global

    variables-

    local variable- global variable- export command.

    a,b 2 local

    variable- global variable- , shell

    environment- export command-

    158

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    159/251

    .

    $ exporta

    $ exportb

    variables- shell script-

    .

    .

    159

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    160/251

    SpecialVariables

    Local variable global variable unix-

    variable-

    .

    $# positional parameters

    .

    $- shell options- ,

    $? execute command- exit

    .

    $$ shell- process .

    160

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    161/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    162/251

    ShellScript- 2

    Hash#

    # type

    , type

    , execution

    .

    shell script

    162

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    163/251

    , # ,

    shell script- .

    ec.sh file-

    comment- , run .

    163

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    164/251

    output- comment-

    .

    EscapeMechanism

    . * (Asterisk symbol) echo

    .

    echo command- *-

    164

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    165/251

    . * unix-

    special character.

    * ,

    Unix.

    character-

    unix- .

    special characters-

    character- unix-

    , character-

    backslash(\) .

    165

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    166/251

    *

    . escape

    mechanism.

    Commandsubstitution

    . unix

    command- echo .

    166

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    167/251

    ls

    .

    ls command-

    backticks- echo .

    ls command-

    output- echo .

    167

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    168/251

    command substitution.

    PositionalParameters

    Shell script- command line-

    arguments- .

    shell script- $1

    argument-, $2 argument-,

    $3 argument- .

    $0 shell script- ,

    168

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    169/251

    $* command line-

    arguments- .

    $1,$2,$3 , arguments-

    position- ,

    positional parameters.

    arguments.sh shell script-

    .

    169

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    170/251

    arguments.sh- command line-

    arguments- .

    170

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    171/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    172/251

    standard input, standard output

    standard error- .

    shell script- ,

    commands , error messages

    ,

    program .

    descriptors- ,

    error messages

    , file- , program

    . 172

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    173/251

    man xyz command

    error- .

    error descriptor- 2-

    file- .

    $ manxyz2> file2

    173

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    174/251

    man ls xyz command, ls-

    output- , xyz- error- .

    , output- file-, error-

    file- .

    $ manlsxyz1> opfile2> errfile

    174

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    175/251

    output error file-

    command- .

    175

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    176/251

    $ manlsxyz> operrfile2>&1

    ShiftCommand176

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    177/251

    shell script- $1 $9

    positional parameters- .

    , shift command-

    .

    exitCommand

    exit command- shell

    script- . shell script-

    177

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    178/251

    0-, 1- .

    NumericalComparisons

    shell script-

    . , 3 5

    .

    3 -eq5 (3 5 (equals) 178

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    179/251

    )

    3 -ne5 (3 5 (not equals)

    )

    3 -gt5 (3- 5- (greater than)

    )

    3 -lt5 (3- 5- (

    greater than)

    )

    179

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    180/251

    3 -ge5 (3- 5-

    (greater than or equal to)

    )

    3 -le5 (3- 5-

    (greater than or equal to)

    )

    command line-

    .180

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    181/251

    $ [ 3 -eq3 ] && echotrue

    $ [ 3 -eq5 ] && echotrue

    $ [ 3 -lt5 ] && echotrue

    $ [ 3 -lt2 ] && echotrue

    181

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    182/251

    command- 3 -eq3

    true . 3 -eq5

    true .

    commands-

    .

    ArithmeticOperators& Expressions

    , , ,

    +, -, *, / arithmetic operators

    .

    shell script-

    182

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    183/251

    . .

    $ expr6 + 4

    $ expr6 4

    $ expr6 \* 4

    $ expr6 / 4

    * operators-

    , \ escape operator-

    .

    183

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    184/251

    , / operator-

    ,

    ,

    .

    ConditionalOperators

    184

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    185/251

    commands- successful

    execution- failed execution-

    commands- execute

    . && ||

    conditional execution operators.

    && operator- successful execution-

    ,

    || operator

    -failed execution

    - commands- execute.

    185

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    186/251

    $ grepApplefruits&& echofound || echoNotfound

    $ grepMangofruits&& echofound || echoNotfound

    186

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    187/251

    ShellScripting 3

    Programminglanguage

    Constructs

    Shell- programming language-

    looping&

    branching,

    operations on variables,

    file

    creation argument passing

    . 187

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    188/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    189/251

    if(condition)

    then

    commands

    else

    commands

    fi

    :

    189

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    190/251

    example2.sh file- if

    statement- , run .

    190

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    191/251

    fruits file- Apple

    if command

    .

    fruits file- absolute

    path . shell

    script- absolute path

    files- .

    caseStatement

    191

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    192/251

    Case statement option-

    ,

    commands- execute .

    syntax:

    casevaluein

    choice1) commands; ;

    choice2) commands; ;

    . . . 192

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    193/251

    esac

    :

    example3.sh file- case

    statement- , run .

    193

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    194/251

    options echo

    statement .

    read function input

    , choice variable-

    .

    194

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    195/251

    case statement choice variable- 1

    pwd command-, 2 date-, 3

    who command- execute

    . * 1,2,3

    ,

    message

    echo statement.

    input- ,

    output

    .

    195

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    196/251

    forLoop

    list-

    output- .

    196

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    197/251

    syntax:

    for in

    do

    Commands

    done

    :

    197

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    198/251

    example4.sh file- for loop-

    , run .

    seq- argument1 10

    command, 1 10

    .

    198

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    199/251

    command- backticks

    output- for loop-

    condition- .

    1 10

    loop- statement execute,

    output .

    199

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    200/251

    .

    200

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    201/251

    whileLoop

    while loop- condition

    loop- commands- execute

    .

    syntax: 201

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    202/251

    while

    do

    Commands

    done

    :

    202

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    203/251

    example5.sh file- while loop-

    , run .

    i variable- 1 assign

    . while loop-

    condition, ivariable, 5 loop-

    203

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    204/251

    execute .

    loop- i variable

    .

    i- 5-

    loop output

    .

    204

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    205/251

    untilLoop

    until loop- while loop- .

    until loop- condition

    loop- commands-

    execute.

    syntax:

    until205

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    206/251

    do

    Commands

    done

    :

    example6.sh file- until loop-

    , run .

    206

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    207/251

    output.

    Functions

    shell script- function 207

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    208/251

    .

    commands-

    , logical

    function-

    .

    functions-

    .

    function input

    , parameter

    .

    Syntax:208

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    209/251

    function_name() {

    commands

    }

    :

    functions.sh file- function-

    , run .

    209

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    210/251

    value1 , value2 2 variables-

    read function 2

    . 2

    add(), sub(), mul(),

    div() 4 functions.210

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    211/251

    functions-

    2 value1 value2

    2 variables function- parameter-

    .

    output .

    211

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    212/251

    212

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    213/251

    JobScheduling

    Shell- jobs- schedule at

    crontab 2 commands.

    .

    atcommand

    213

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    214/251

    command/shell script

    execute

    schedule at

    command.

    $ touchindia| at16.39

    touch command 4:39 PM-

    india file- .

    crontab

    Crontab- command/shell

    214

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    215/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    216/251

    day of week (0 6 ) (0=Sunday)

    touch command

    25- 4. 40

    crontab-

    command .

    $ crontab-e

    40 16 25 * * touchtrade

    (press)Esc:wq216

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    217/251

    (press)Enter

    40 ,

    16 , 25

    . *

    , *

    .

    217

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    218/251

    crontab- schedule

    commands l option-

    . .

    $ crontab-l

    218

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    219/251

    219

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    220/251

    Rsync backup

    .

    ,

    .

    rsync ,

    , ,

    220

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    221/251

    .

    ;

    :

    source file

    directory destination .

    , Source

    file directory

    . backup,

    . 221

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    222/251

    :

    , ssh

    encryption

    , .

    bandwidth:

    ,

    . (compress).

    , . (extract).

    bandwidth.222

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    223/251

    :

    . root

    .

    Syntax:

    rsync

    source destination,

    network . 223

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    224/251

    , , IP

    hostname destination full path

    .

    1;

    directory sync.

    -zvr options

    .

    224

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    225/251

    $ rsync-zvr/var/opt/installation/inventory/ /root/

    building file list... done

    sva.xml

    svB.xml

    .

    sent26385 bytes received1098 bytes 54966.00 bytes/se

    total size is44867 speedup is1.63

    $

    ,

    225

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    226/251

    -z= compress

    -v= verbose

    -r= recusrsive .

    timestamp

    .

    $ ls-l/var/opt/installation/inventory/sva.xml/root

    -r--r--r-- 1 bin bin 949 Jun18 2009 /var/opt/installati

    -r--r--r-- 1 root bin 949 Sep 2 2009 /root/temp/sva.xml

    226

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    227/251

    . .

    2: metadata sync.

    Rsync -a option

    sync.

    -a= archive mode

    symbolic link

    permissions 227

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    228/251

    timestamp

    owner, group

    -a .

    $ rsync-azv/var/opt/installation/inventory/ /root/

    building file list... done228

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    229/251

    ./

    sva.xml

    svB.xml

    .

    sent26499 bytes received1104 bytes 55206.00 bytes/se

    total size is44867 speedup is1.63

    $

    timestamp sync

    .

    $ ls-l/var/opt/installation/inventory/sva.xml/root

    -r--r--r-- 1 root bin 949 Jun18 2009 /var/opt/installat229

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    230/251

    -r--r--r-- 1 root bin 949 Jun18 2009 /root/temp/sva.xml

    3: file- rsync

    $ rsync-v/var/lib/rpm/Pubkeys/root/temp/

    Pubkeys

    sent42 bytes received12380 bytes 3549.14 bytes/sec

    total size is12288 speedup is0.99

    230

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    231/251

    4: local remote

    sync

    remote , , IP

    () hostname, destination directory path

    . username@hostname:

    /full/path/to/destination.

    remote password( )

    rsync

    .

    Passwordless ssh , password231

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    232/251

    , remote rsync .

    $rsync

    -avz

    /root

    /temp

    /shrini

    @192.168.200.10:/home

    /shr

    Password:

    building file list... done

    ./

    rpm/rpm/Basenames

    rpm/Conflictname

    sent15810261 bytes received412 bytes 2432411.23 bytestotal size is45305958 speedup is2.87

    232

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    233/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    234/251

    Password:

    receiving file list... done

    rpm/

    rpm/Basenames

    .

    sent406 bytes received15810230 bytes 2432405.54 bytes

    total size is45305958 speedup is2.87

    6: remote shell

    -e option remote shell

    . -e ssh

    encryption rsync. 234

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    235/251

    $ rsync-avz-e ssh [email protected]:/var/lib/rpm/r

    Password:

    receiving file list... done

    rpm/

    rpm/Basenames

    sent406 bytes received15810230 bytes 2432405.54 bytes

    total size is45305958 speedup is2.87

    7: Destination- , overwrite

    .235

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    236/251

    destination- File

    . rsync source-

    . -u option.

    $ ls-l/root/temp/Basenames

    total39088

    -rwxr-xr-x1 root root 4096 Sep 2 11:35 Basenames

    $ rsync-avzu [email protected]:/var/lib/rpm/root/t

    Password:

    receiving file list... done 236

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    237/251

    rpm/

    sent122 bytes received505 bytes 114.00 bytes/sec

    total size is45305958 speedup is72258.31

    $ ls-lrt

    total39088

    -rwxr-xr-x1 root root 4096 Sep 2 11:35 Basenames

    8: directory structure- rsync

    Directory Tree (File ) rsync237

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    238/251

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    239/251

    9: Progress

    file- rsync,

    . rsync

    . progress

    .

    rsnapshot

    .

    $ rsync-avz--progress [email protected]:/var/lib/

    Password:

    receiving file list... 239

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    240/251

    19 files to consider

    ./

    Basenames

    5357568 100% 14.98MB/s 0:00:00 (xfer#1, to-check=17/19)

    Conflictname

    12288 100% 35.09kB/s 0:00:00 (xfer#2, to-check=16/19)

    .

    .

    .

    sent406 bytes received15810211 bytes 2108082.27 bytes

    total size is45305958 speedup is2.87

    240

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    241/251

    10: Destination- delete

    source- file delete,

    target- delete.

    .

    delete delete.

    # Source and target are in sync. Now creating new fil

    $ > new-file.txt

    241

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    242/251

    $ rsync-avz--delete [email protected]:/var/lib/rpm

    Password:

    receiving file list... done

    deleting new-file.txt

    ./

    sent26 bytes received390 bytes 48.94 bytes/sec

    total size is45305958 speedup is108908.55

    11: rsync

    242

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    243/251

    source file ,

    target file rsync

    . existing.

    [/var/lib/rpm]$ > new-file.txt

    $ rsync-avz--existing [email protected]:/var/lib/rpm/ [email protected]'s password:

    receiving file list... done

    ./

    sent26 bytes received419 bytes 46.84 bytes/sec

    total size is88551424 speedup is198991.96243

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    244/251

    12: source/destination

    -i.

    Source:

    $ ls-l/var/lib/rpm

    -rw-r--r-- 1 root root 5357568 2010-06-24 08:57 Basenames

    -rw-r--r-- 1 root root 12288 2008-05-28 22:03 Conflictnam

    -rw-r--r-- 1 root root 1179648 2010-06-24 08:57 Dirnames244

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    245/251

    Destination:

    $ ls-l/root/temp

    -rw-r--r-- 1 root root 12288 May28 2008 Conflictname

    -rw-r--r-- 1 bin bin 1179648 Jun24 05:27 Dirnames

    -rw-r--r-- 1 root root 0 Sep 3 06:39 Basenames

    $ rsync-avzi [email protected]:/var/lib/rpm/ /root/

    Password:

    receiving file list... done

    >f.st.... Basenames

    .f....og. Dirnames 245

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    246/251

    sent48 bytes received2182544 bytes 291012.27 bytes/s

    total size is45305958 speedup is20.76

    13:

    rsync- ,

    .

    $ rsync-avz--include'P*' --exclude'*' [email protected]

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    247/251

    Password:

    receiving file list... done

    ./

    Packages

    Providename

    Provideversion

    Pubkeys

    sent129 bytes received10286798 bytes 2285983.78 bytes

    total size is32768000 speedup is3.19

    14: file size limit

    247

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    248/251

    max-size option file-

    rsync .

    $ rsync-avz--max-size='100K' [email protected]:/var/

    Password:receiving file list... done

    ./

    Conflictname

    GroupInstalltid

    Name248

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    249/251

    Sha1header

    Sigmd5

    Triggername

    sent252 bytes received123081 bytes 18974.31 bytes/se

    total size is45305958 speedup is367.35

    15: file- sync

    source, target file rsync

    file

    rsync

    -w

    .

    249

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    250/251

    network bandwidth .

    checksum ,

    .

    # rsync-avzW [email protected]:/var/lib/rpm/ /root

    Password:

    receiving file list... done

    ./

    Basenames

    Conflictname

    Dirnames

    Filemd5s

    Group

    Installtid

    250

  • 7/24/2019 Learn GNULinux Part 2 6 Inch

    251/251