Part 2 Basic Knowledge of UNIX

Embed Size (px)

Citation preview

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    1/70

    Integration departmentIntegration departmentIntegration departmentIntegration department

    ISSUEISSUE 1.21.2

    UNIX FundamentalsUNIX FundamentalsUNIX FundamentalsUNIX Fundamentals

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    2/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Course ContentsCourse Contents

    UNIX Brief introduction

    UNIX Basic operationcommands

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    3/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIXIntroductionUNIXIntroduction

    Content Content

    UNIX Versions and Standards UNIX Versions and Standards UNIX Features UNIX Features

    UNIX Structure UNIX Structure

    UNIX Users UNIX Users

    UNIX Shell UNIX Shell

    UNIX File System UNIX File System

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    4/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX versions and standards UNIX versions and standards

    BSD UNIX

    UNIX System V

    UNIXIntroductionUNIXIntroduction

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    5/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX Features UNIX Features

    Multi-task Multi-task

    Multi-user Multi-user

    Pipes Pipes

    High-capability Shell High-capability Shell

    Security Security Stability Stability

    Graphic user interface Graphic user interface

    Network support Network support

    UNIXIntroductionUNIXIntroduction

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    6/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Hardware System Hardware System

    UNIX Kernel UNIX Kernel

    Unix Shell

    Unix Shell

    Application Program Application Program

    UNIX Structure UNIX Structure

    kernelkernel

    shellshell

    applicationapplication

    kernelkernel

    hardwarehardware

    UNIXIntroductionUNIXIntroduction

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    7/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX Users UNIX Users

    Ordinary User

    Group

    Super User(root)

    UNIXIntroductionUNIXIntroduction

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    8/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX Shell Program UNIX Shell Program

    ShellType

    main featuresrevi

    ationcomm

    andPromp

    t

    ourneShell

    riginal most popular Provided y every UNIX is the ase of three Shellprograms.

    Shell sh $

    ornShell

    e tensions of Shell compati le with Shell.

    Shell sh $

    C-Shell

    nalogous to Clanguage morecapa ility than Shell the most powerful Shellprogram.

    C Shell csh %

    UNIXIntroductionUNIXIntroduction

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    9/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX file system UNIX file system

    ree Structure ree Structure

    Root File System Root File System

    User Home Directory

    User Home Directory

    /

    bin dev etc home1 var cdrom

    sh csh is dsk tty01 Rc2.d omc sybase tmp

    S98sybserver

    bin data install bin

    UNIXIntroductionUNIXIntroduction

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    10/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX is a multi-user, multi-task operatingsystem.

    UNIX system consists of hardware, Kernel,

    Shell and application program.

    he user sends commands to Kernel throughshell.

    UNIX file system has tree structure.

    UNIX is a multi-user, multi-task operatingsystem.

    UNIX system consists of hardware, Kernel,

    Shell and application program.

    he user sends commands to Kernel throughshell.

    UNIX file system has tree structure.

    Summary Summary

    UNIXIntroductionUNIXIntroduction

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    11/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Course ContentsCourse Contents

    UNIX Brief introduction

    UNIX Basic operationcommands

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    12/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Unix OperationUnix Operation

    UNIX Basic Operation UNIX Basic Operation

    Directory Operation Commands Directory Operation Commands

    File Navigation Commands File Navigation Commands

    File Management Commands File Management Commands

    Pipe Commands Pipe Commands

    System Resources Commands System Resources Commands

    Network Operation Commands Network Operation Commands

    vi Common Commands vi Common Commands

    System Maintenance Commands System Maintenance Commands

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    13/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX Basic OperationUNIX Basic Operation

    UNIX Login and Exit UNIX Login and Exit

    UNIX Switch User UNIX Switch User

    Use of UNIX Command Line Use of UNIX Command Line

    Use ofControl Key Use ofControl Key

    Clear Screen Clear Screen UNIX on line Help UNIX on line Help

    UNIX Restart and Close UNIX Restart and Close

    Content Content

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    14/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Log in Unix system Login password

    Exit Unix System

    exit

    UNIX Basic OperationUNIX Basic Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    15/70

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    16/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    command line structure command [options] [parameters].

    here is a blank between them.

    Capital and small letters are different in UNIX

    commands.

    If many parameters are usedthey can be linedup

    command -[option1][option2][option3][ ...]

    Command Line Command Line

    UNIX Basic OperationUNIX Basic Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    17/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Control Keys Control Keys

    Command unctionControl-C Stop running the program

    a normally

    Control- Stop the system communication

    Control-S To tell the terminal to stop

    accepting input

    Control-Q To tell the terminal to acceptinput

    UNIX Basic OperationUNIX Basic Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    18/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    clear

    Clear command Clear command

    UNIX Basic OperationUNIX Basic Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    19/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    System help System help

    man find

    UNIX Basic OperationUNIX Basic Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    20/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX system restart UNIX system restart

    # reboot

    UNIX system shutdown UNIX system shutdown

    # shutdown hy 0

    UNIX Basic OperationUNIX Basic Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    21/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX OperationUNIX Operation

    Directory operation commands Directory operation commands

    pwd: display current directory

    cd: change a directory

    ls: list directory contents

    mkdir: make a directory rmdir: remove a directory

    pwd: display current directory

    cd: change a directory

    ls: list directory contents

    mkdir: make a directory rmdir: remove a directory

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    22/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Absolute path and relative path Absolute path and relative path

    Absolute path is based on root. Directories are

    separated by solidus / . Example/home1/omc/data/license.dat

    Relative path is based on current directory.

    . represents current directory.

    .. represents parent directory of current directory.

    Example: the current directory is /home1/omc, iflicense.dat is under the directory /home1/ omc/

    data, the relative path for this file is ./data/

    license.dat

    Absolute path is based on root. Directories are

    separated by solidus / . Example/home1/omc/data/license.dat

    Relative path is based on current directory.

    . represents current directory.

    .. represents parent directory of current directory.

    Example: the current directory is /home1/omc, iflicense.dat is under the directory /home1/ omc/

    data, the relative path for this file is ./data/

    license.dat

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    23/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    pwd: display current directory pwd: display current directory

    Directory Operation Command Directory Operation Command

    /

    in li home dev etc

    mydir

    su su su

    other

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    24/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    cd: change current directory

    Format: cd [path]

    [path]:Absolute,relative path

    cd: change current directory

    Format: cd [path]

    [path]:Absolute,relative path

    return to user main directory: cd

    enter system root directorycd / enter parent directorycd ..

    enter the second hierarchical

    directorycd ../..

    return to user main directory: cd

    enter system root directorycd / enter parent directorycd ..

    enter the second hierarchical

    directorycd ../..curdir

    lastdir

    Directory Operation Command Directory Operation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    25/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    ls: list directory content

    Format: ls [option] [path] [path]: absolute or relative path

    ls: list directory content

    Format: ls [option] [path] [path]: absolute or relative path

    [option]:

    -l:list file features

    -a:list all files, including hidden

    files that begin with a dot (.)

    -s: display file block number

    [option]:

    -l:list file features

    -a:list all files, including hidden

    files that begin with a dot (.)

    -s: display file block number

    Directory Operation Command Directory Operation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    26/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    mkdir: make a directory

    Format: mkdir [path]

    [path]absolute or relative path

    mkdir: make a directory

    Format: mkdir [path]

    [path]absolute or relative path

    newdir

    Directory Operation Command Directory Operation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    27/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    rmdir: remove a directory

    Format: rmdir [path]

    [path]absolute or relative path

    rmdir: remove a directory

    Format: rmdir [path]

    [path]absolute or relative path

    olddir

    Directory Operation Command Directory Operation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    28/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    File Navigation Command File Navigation Command

    cat: list a file

    more:page through a text file

    head:display file head

    tail:display file tail

    cat: list a file

    more:page through a text file

    head:display file head

    tail:display file tail

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    29/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    cat:list a file format:cat [option] [path][[path]

    ] [path]absolute or relative path [option]

    -ndisplay new line including blanklines-bdisplay new line not including blanklines

    cat:list a file format:cat [option] [path][[path]

    ] [path]absolute or relative path [option]

    -ndisplay new line including blanklines-bdisplay new line not including blanklines

    File Navigation Command File Navigation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    30/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    more: page through a text file

    format: more [path]

    [path]: absolute or relative path

    more: page through a text file

    format: more [path]

    [path]: absolute or relative path

    File Navigation Command File Navigation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    31/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    head:display the first 10 lines of the file

    format:head [option] [path]

    [path]: absolute or relative path

    [option]:-n: n represents the first n lines

    head:display the first 10 lines of the file

    format:head [option] [path]

    [path]: absolute or relative path

    [option]:-n: n represents the first n lines

    File Navigation Command File Navigation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    32/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    tail:display the last 10 lines of the file

    format:tail [option] [path]

    [path]absolute or relative path

    [option]

    -nn represents the last n lines

    tail:display the last 10 lines of the file

    format:tail [option] [path]

    [path]absolute or relative path

    [option]

    -nn represents the last n lines

    File Navigation Command File Navigation Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    33/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    File Management Command File Management Command

    cp: copy a file mv: move a file

    rm: remove a file

    find: look for a file

    chmod: change a file or directory accesspermissions

    chown: change the ownership of a file

    chgrp: change the group of a file

    cp: copy a file mv: move a file

    rm: remove a file

    find: look for a file

    chmod: change a file or directory accesspermissions

    chown: change the ownership of a file

    chgrp: change the group of a file

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    34/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    cp: copy a file

    format: cp

    [path]: absolute or relative path

    cp: copy a file

    format: cp

    [path]: absolute or relative path

    File Management Command File Management Command

    From

    To

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    35/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    mvmove a file or rename a file

    format: mv

    [path]absolute or relative path

    mvmove a file or rename a file

    format: mv

    [path]absolute or relative path

    From

    To

    File Management Command File Management Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    36/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    rmremove a file

    format: rm [options] [path]absolute or relative path

    [options]

    -iinteractive operation

    -rrecursively copy a directory

    -fclose interactive operation

    rmremove a file

    format: rm [options] [path]absolute or relative path

    [options]

    -iinteractive operation

    -rrecursively copy a directory

    -fclose interactive operation

    File Management Command File Management Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    37/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    difference between rm -r and rmdir

    rmdirremove a directory which should be

    empty

    rm -r

    remove the directory and its contents

    difference between rm -r and rmdir

    rmdirremove a directory which should be

    empty

    rm -r

    remove the directory and its contents

    File Management Command File Management Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    38/70

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    39/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    techniques of using find command

    1run

    Example find . -name test -print>abc.file&

    cat abc.file

    2search under root directory by superuser

    techniques of using find command

    1run

    Example find . -name test -print>abc.file&

    cat abc.file

    2search under root directory by superuser

    File Management Command File Management Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    40/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    File Management Command

    File Management Command

    UNIX OperationUNIX Operation

    $ ls -l sort

    -rwxr-x--x 1 myname mygroup 120 Jul 26 10:20 sort

    other

    group

    owner

    file type

    - An ordinary file

    b A block file

    c A character file

    l A link

    d A directory

    owner group

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    41/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    File Management Command-chmod

    File Management Command-chmod

    UNIX OperationUNIX Operation

    $ ls -l sort

    -rwxr-x--x 1 myname mygroup 120 Jul 26 10:20 sort

    $ chmod 770 sort

    $ ls -l sort

    -rwxrwx--- 1 myname mygroup 120 Jul 26 10:20 sort

    $ chmod g-w,o+x sort

    $ ls -l sort

    -rwxr-x--x 1 myname mygroup 120 Jul 26 10:20 sort

    $ chmod u=rw,g=wx,o=rwx sort

    $ ls -l sort

    -rw--wxrwx 1 myname mygroup 120 Jul 26 10:20 sort

    rwxr-x--x111101001

    7 5 1

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    42/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    chown:change file owner

    format:chown [option] user[:user group]

    filename

    Example:

    # chown new-owner filename

    Notice:change file owner only under super

    user

    chown:change file owner

    format:chown [option] user[:user group]

    filename

    Example:

    # chown new-owner filename

    Notice:change file owner only under super

    user

    File Management Command File Management Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    43/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    chgrpchange the group of the file

    format: chgrp [option] user_group filename

    Example#chgrp new_group filename

    Notice

    1. he group name should exist before

    changing file group name2. After changing file featuresits sub

    directory and file features don't be changed

    chgrpchange the group of the file

    format: chgrp [option] user_group filename

    Example#chgrp new_group filename

    Notice

    1. he group name should exist before

    changing file group name2. After changing file featuresits sub

    directory and file features don't be changed

    File Management Command File Management Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    44/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Pipe Command Pipe Command

    file redirection

    grep: search string

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    45/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    symbol redirection fuction

    > output redirection

    >> add output

    | pipe operation

    < input redirection

    file redirection file redirection

    Pipe Command Pipe Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    46/70

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    47/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    system resources command system resources command

    who:display all login users date:display and set system time

    df, du:display disk status

    whereisreport the place of command

    hostname:display host name

    ifconfigcheck host IP

    who:display all login users date:display and set system time

    df, du:display disk status

    whereisreport the place of command

    hostname:display host name

    ifconfigcheck host IP

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    48/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    who: display current all login users

    system resources command system resources command

    format: who

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    49/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    Date:display and set current system time

    system resources command system resources command

    format:date [mmddhhmmyy[.ss]]

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    50/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    common optiondf [options] [resource]

    [options]

    -l local file system-k report disk space by unit "k"

    common optiondf [options] [resource]

    [options]

    -l local file system-k report disk space by unit "k"

    dfreport disk remained space dfreport disk remained space

    system resource command system resource command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    51/70

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    52/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    whereis reports the place of command whereis reports the place of command

    usagewhereis [option]

    [command]

    system resource command system resource command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    53/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    usagehostname

    [hostname]

    hostnamereports or sets hostname

    hostnamereports or sets hostname

    system resource command system resource command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    54/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    ifconfigshow the IP

    address of the host

    $ ifconfig -a

    system resource command system resource command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    55/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    network operation command network operation command

    ping:network test

    telnet:remote access

    ftp:transfers file

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    56/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    ping:tests the physicalstate of the network

    network operation command network operation command

    format: ping

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    57/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    telnet:remote access theUNIX system

    network operation command network operation command

    format: telnet

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    58/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    ftp:transfers file ftp:transfers file

    ftp

    network operation command network operation command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    59/70

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    60/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    ftpcommands

    e planation

    or help[command]

    help

    inarytransfer file y inary

    mode

    asciitransfer file y SCII

    mode default value

    cd[directory]

    change remote directory

    lcd[directory]

    change local directory

    put file[file ]

    copy local file toremote file

    ftp

    commands

    e planation

    get file[file ]

    copy remote file tolocal file

    mput filescopy many local files

    to remote

    mget filescopy many remote

    files to local

    closeclose remoteconnection

    quit orye

    e it ftp

    F P useful commands F P useful commands

    network operation command network operation command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    61/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    vi useful commands vi useful commands vi start: vi filename vi start: vi filename

    two modestext mode and command mode two modestext mode and command mode

    text insert commanda, A, I, i, o or O text insert commanda, A, I, i, o or O

    cursor move commandh, j, k, l cursor move commandh, j, k, l

    text remove commandx, dd text remove commandx, dd

    exit with saving:wq exit with saving:wq

    exit without saving :q! exit without saving :q!

    UNIX OperationUNIX Operation

    Commonly used command in vi: Commonly used command in vi:

    the ESC

    key is used to change the text mode tocommand mode

    the ESC

    key is used to change the text mode tocommand mode

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    62/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX Maintenance Command UNIX Maintenance Command

    user management command

    process management command

    system backup command

    user management command

    process management command

    system backup command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    63/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    User Management Commands User Management Commands

    command line command line

    useradd: add user account useradd: add user account

    userdel: delete user account userdel: delete user account

    groupadd: add user group groupadd: add user group

    groupdel: delete user group groupdel: delete user group

    admintool admintool

    graphic graphic

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    64/70

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    65/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    kill: clear process kill: clear process

    format:kill [options] process id

    [options]

    -l: list all useful kill command signals

    -s: send fixed signal to a process

    example: -9 means killing the process forcibly.

    format:kill [options] process id

    [options]

    -l: list all useful kill command signals

    -s: send fixed signal to a process

    example: -9 means killing the process forcibly.

    Process Management Command Process Management Command

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    66/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    System Backup Command System Backup Command

    tar:system backup command tar:system backup command

    tar [options [modifier]] file [options]

    xread

    cmake a new database

    vstart display mode

    fmeans file database is file.

    tar [options [modifier]] file [options]

    xread

    cmake a new database

    vstart display mode

    fmeans file database is file.

    UNIX OperationUNIX Operation

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    67/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX OperationUNIX Operation TarTarUNIX OperationUNIX Operation TarTar

    1Save archive file to tape

    # tar cvf /dev/rmt /0m /var

    2Save archive file to a regular file

    # tar cvf data.tar /app/mydata

    3List the content of the archive file

    # tar tvf data.tar

    4extract the archive file

    # tar xvf data.tar

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    68/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX OperationUNIX Operation CronCronUNIX OperationUNIX Operation CronCron

    # crontab -e create a crontab file

    # crontab -l list crontab file

    # crontab -r delete crontab file

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    69/70

    Confidential Information of Huawei.No Spreading without Permission. Security Level: Internal

    UNIX OperationUNIX Operation Cron FileCron FileUNIX OperationUNIX Operation Cron FileCron File

    min hour date month day command

    0-59 0-23 1-31 1-12 0-6

    0 * * * * /usr/bin/date >/dev/console

    30 0 1,15 * 0 > /var/adm/wtmp0 0 * * 1-5 /usr/bin/rm /home/usr/logfile

    0 20 * * 1 /myusr/test.sh >/dev/null

  • 8/6/2019 Part 2 Basic Knowledge of UNIX

    70/70