การใช้งานคำสั่ง UNIX เบื้องต้น Linux Command

  • Upload
    sanyahv

  • View
    170

  • Download
    0

Embed Size (px)

DESCRIPTION

Fundamental Unix Command - Thai Lang

Citation preview

  • HOMEHOME WEB RESOURCEWEB RESOURCE GRAPHIC RESOURCEGRAPHIC RESOURCE PHP PROJECTPHP PROJECT

    RSS FEED RSS FEED

    TWITTER TWITTER

    GRAPHIC DESIGNGRAPHIC DESIGN

    UNIX Linux Command UNIX Linux Command khongdeee 06:50

    ftpftp host ftp user name password ftp host public username public user anonymous password user anonymous E-mail connect directory pub $ ftp hostname c:windows> ftp wihok.itgo.com$ ftp ftp.nectec.or.th ftp ftp> help ftpftp> open hostname connect host ftp> close disconnect host ftp> bye quit ftpftp> ls dir current directory host ftp> get host localhost ftp> mget host localhostftp> put localhost host ftp> mput localhost host ftp> cd directoryftp> delete mdelete

    ls dir dos $ ls [-option] [file]option

    l permission , , , , a ( dir /ah)p / directoryF / = directory* = execute file@ = link fileld directory (dir /ad)R directory (dir /s)

    $ ls$ ls -la

    more pipe line ( | ) space Enter $ ls -la | more$ more filename

    cat type dos $ cat filename

    clear cls dos terminal $ clear

    date $ date 17 May 1999

    Blogger.

    (1) (1) (2) (1) (4)

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    1 of 8 4/7/2014 10:59 PM

  • cal $ cal month year $ cal 07 1999

    logname$ logname

    id$ id

    tty terminal $ tty

    hostname$ hostname

    uname OS cpu $ uname -a

    history$ history !

    echo banner$ echo "Hello" "Hello" $ banner "Hello" "Hello"

    who , w finger $ who$ w$ finger host $ finger @daidy.bu..ac.th Host $ finger wihok $ who am i $ whoami logname

    pwd directory $ pwd

    mkdir directory MD DOS$ mkdir dir_name

    cp copy $ cp [-irfp] file_source file_targetoption -i option -r copy directory option -f option -p $ cp file_test /tmp/file_test

    mv move $ mv [-if] file_source file_target option cp$ mv index.html main.html index.html main.html

    rm directory del deltree dos $ rm [-irf] filename$ rm -r dir_name dir_name dir_name directory $ rm -i *

    rmdir directory rd Dos$ rmdir dir_name

    alias

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    2 of 8 4/7/2014 10:59 PM

  • $ alias l = ls -l$ alias c = clear

    unalias alias $ unalias c

    type $ type command$ type clear

    find $ find /usr/bin -name "*sh" -print sh /usr/bin

    grep$ grep file

    manman $ man ls$ man cp

    write host $ write s0460003

    mesg$ mesg status terminal$ mesg y terminal $ mesg n terminal

    talk Ctrl + c host $ talk username@hostname

    pine menu tar

    Packet zip zip output filename.tar packet filename.tar gzip compress packet

    $ tar -option output input-option -cvf , -tvf , -xvf output .tar device tape input directory $ tar -cvf Output_file.tar /home/myhome/*Option -cvf .tar /home/myhome/ Output_file.tar$ tar -tvf filename.tarOption -tvf .tar preview tar -tvf filename.tar |more$ tar -xvf filename.tarOption -xvf .tar current directory

    gzip

    zip Unzip packet .tar $ gzip filename.tar zip filename.tar.gz$ gzip -d filename.tar.gz unzip filename.tar

    Compress Uncompress

    compress .Z gzip gzip -d $ compress -v file.tar file.tar.Z Option -v verify compress$ uncompress -v file.tar.Z

    --------------------------------------------------------------------------------

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    3 of 8 4/7/2014 10:59 PM

  • Operating System Component

    1.Kernel kernel kernel

    2.File System (FS) OS OS FS

    Operating System File SystemDOS/Windows95 FAT12,FAT16Windows98/95-osr FAT12,FAT16,FAT32Windows NT NTFS,FAT16,HPFSOS/2 FAT12,FAT16,HPFSLinux EXT2,VFAT,HPFS,NTFS,etc. SunOS UFS

    Linux File System Ext2 (Extended Files System 2) Linux 4 (Tbytes) 4000 Gbytes

    3.Shell command Interpreter user kernel Shell Script shell Input / Output > output< input>> output

    shell 2

    Synchronous execution prompt ( foreground mode)

    $ ls -l ( list directory )

    Asynchronous execution shell prompt shell (background mode) ampersand (&)

    $ netscape & ( netscape prompt netscape )

    Shell

    Bourne Shell (sh) starndard shell unix shell script unix Algol Procedure default prompt "$"

    C Shell (csh) C bourne shell shell script bourne shell default prompt "%"

    Korn Shell (ksh) sh csh unix ksh shell shell script Standard IEEE PDSIX 1003.2 default prompt "$"

    Bourne Again Shell (bash) sh (default of Linux) default prompt "$"

    4.Utilities unix kernel

    Unix 255 ^ " ', - ? ] () ~ ! $ @ # $ / "." hidden file option

    Regular files Text Editor

    Directory files Directory Sub Directory Directory (root) " / "

    Special files Character device file Block device file

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    4 of 8 4/7/2014 10:59 PM

  • device driver /dev Character device file Block device file

    Unix demain seckets BSD Unix Name pipes AT&T Unix

    Symbolic Link files 2

    1. Hard Link I-node I-node I-node partition

    2. Symbolic Link I-node shutcut windows 95 link file link file partition partition

    ls -l

    Type Sysbol Create RemoveText file - cp , mv ,etc rmDirectory p mkdir rm -r , rmdirCharacter device v mknod rmBlock device b mknod rmUnix domain socket s socket rmName pipes p mknod rmlink file l ln -s rm

    Filesystem Hierarchy Standard (FHS) root /

    / root kernel

    /bin

    /dev

    /etc config files

    /etc/X11 config files x windows

    /etc/skel home user

    /lib

    /sbin

    /usr

    /var

    PERMISSION OS user id group id user home directory user user user 3

    Owner Group gid Other

    Read Permission rWrite Permission wExecute Permission Run x

    user Permission $ ls -la-rwxr--r-- 1 wihok Special 5223 May 12 10:10 .profile -rwxr--r-- 1 wihok Special 2022 May 12 10:13 .kshrcdrwx------ 2 wihok Special 1024 May 12 10:34 mail -rw-r--r-- 1 wihok Special 11211 May 12 11:01 test 7 filed

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    5 of 8 4/7/2014 10:59 PM

  • Field

    1 File Type Permission 2 link 3 (owner) 4 (group) 5 (byte) 6 - update 7

    field 1 Permission

    1 2-4 Owner 5-7 Group 8-10 Other

    .kshrc permission -rwxr--r-- Owner Run user owner other permission

    --------------------------------------------------------------------------------

    Permission permission Admin

    1. chmod permission 2

    Absolute Permission

    $ chmod filename r 4 w 2 x 1 - 0

    permission ( owner , group other) test owner Run group run other run

    Permission rwx r-x --xNumber 7 5 1 : $ chmod 751 test

    Relative Permission

    u () + r () g () - w () o () = x (Run) a ()

    permission .kshrc rwxr--r-- rwxrw-r--$ chmod g+w .kshrc permission .profile rwxr--r-- rwxrw-rw-$ chmod go+w .profile

    2. chown

    $ chown newuser test field 3 ls -la wihok newuser

    3. chgrp

    $ chgrp newgroup test field 4 ls -la Special newgroupText EditorText Editor pico vi pico unix text text editor vi text editor vi

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    6 of 8 4/7/2014 10:59 PM

  • text editor$ pico filename $ pico$vi filename $ vi

    vivi text editor 3 mode

    Command Mode cursor ( editor ,Home ,End ,insert, delete vi )

    Edit Mode

    Last Line Mode save , open , quit , ,

    mode vi Esc Last line Mode Esc Shift + : :

    Command Mode mode mode

    h cursor j cursor 1 k cursor 1 l cursor w cursor b cursor $ cursor 0 cursor nG n n Ctrl+f cursor 1 Ctrl+b cursor 1 Ctrl+L Refresh [[ ]] yy Copy yw Copy yG Copy y$ Copy p Paste cursor P Paste cursor cw word c$ cG r 1 R Esc u Undo x cursor X cursor dw dd d$ cursor d0 cursor dG cursor

    Edit Mode mode

    a cursor A i cursor I o cursor O cursor

    Last Line Mode mode Esc : :

    :q! quit :w! save :wq! save and quit :w! filename save as filename :e! filename open filename :/string :help :set nu :set nonu

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    7 of 8 4/7/2014 10:59 PM

  • :

    0 :

    :

    Pages 3 1 2 3 Last

    khongdeee.blogspot.com Thank for Agus - Development Webmaster Contact me bemler84[at]hotmail.com Mobile.084-6001711(Thailand) Power by Blogger.com

    UNIX Linux Command http://khongdeee.blogspot.com/2012/06/unix-linux-command.html

    8 of 8 4/7/2014 10:59 PM