SlideShare a Scribd company logo
Command Line (Linux             1)

ls
                                                      dir     DOS)
list
              ls [option] [file]
option                 ls
-l                      Long Format                  Permission
-a
-F                 Directory                              execute
                      ls –l     ls -al    ls -F


adduser
           User                Unix,Linux
                    adduser -g (group) -d (Directory) (User)
          adduser -g root -d /home/user1 user               User        Login
user1                         root


useradd
           User                Unix,Linux (                     adduser)
                    useradd -g (group) -d (Directory) (User)
          useradd -g root -d /home/user1 user               User        Login
user1                         root


userdel
          User                     Unix,Linux
                    userdel [option] (Username)
          userdel -r root user1          User     Login     User1         -r
Home Directory       User1
passwd
                                     User                Unix,Linux
                   passwd [Username]
          passwd user1 (                         User1                    User
        Unix
          Login


alias
                                Unix,Linux (
SET      DOS                            RUN
                   alias [
          alias copy=cp                 copy                  cp
bash
               Bourne again shell                Unix,Linux
                   bash
          bash [Enter] (         Bourne again shell)


bc
                                                 Unix,Linux
                   bc [-lwsqv] [option] [file]
          bc [Enter] 1+2 [Enter] 1^2 [Enter] a=3 [Enter] b=4 [Enter] a*b
[Enter] x=2;y=5;x+y[Enter] [Ctrl-d]
                              Install Packet


cp
                                                      copy         DOS)
copy
             cp source target
                     #cp test.txt /home/user1


cal
                                 Unix,Linux
                    cal
        cal [Enter](
cal -y [Enter](


cat
                          File          Unix,Linux
(                 Type       DOS)
                    cat
        cat /home/user1 | more
                     home/user1


C Compiler
      Compile            C           Unix,Linux (              Type       DOS)
                    cc [filename]
        cc /home/user1/industry.c                    Compile          C
industry.c Directory /home/user1




cd
Change Directory                Unix,Linux (                 CD   DOS)
                     cd [directory]
           cd /etc [Enter]   Directory etc
cd ..[Enter]          Directory     1


chfin
        Change your finger information                  Unix,Linux
(                            User


                     chfn [username]
           chfn User1                           User1


chgrp
        Change Group                Unix,Linux (
                     chgrp [-chfRv] (Group) (File)
           chgrp root /root/*           Group
root           Group root


chmod
        Change Mode                Unix,Linux
(
                     chmod [            File)
                                        test     chmod 754 test       chmod go
+r-w test                        chmod o-r *
         Mode rwx = 7 ; rw - =6 ; r-x =5 ; r- - = 4 ; - wx = 3 ; - w - = 2 ; - - x
=1;--=0
                             2
1.
2.                2             1
          User Group Other = ugo           go-r-w+x
                                    Run
              -rwxrwxrwx = Read Write Execute
              111 101 100 = 754                                Group
              Execute




chown
       Change Owner                 Unix,Linux (
                      chown [                      File)
         chown user1 filename                              filename
     User1
chown -R user1.root
dirname                                                            Sub
dirname.


chsh
       chsh            Unix,Linux (                Shell   User)
                      chsh [Username]
         chsh user1 [Enter] /bin/bash [Enter]


clear
clear               Unix,Linux (
cls     dos)
                      clear
            clear [Enter]


cal
                                Unix,Linux
                      cal
            cal [Enter](
cal -y [Enter](


mesg
mesg status                                terminal
mesg y             terminal
mesg n               terminal


date


            date 17 May 2004


df
       df           Unix,Linux (
                     df [option] [file]
            df [Enter]


dmesg
       dmesg                Unix,Linux (              Boot)
dmesg
          dmesg | more [Enter]
                                                     Linux           Driver CD-
Rom


echo
       echo            Unix,Linux (
ECHO           DOS)
                      echo (
          echo my name is user1
echo Hello > /dev/tty2                Hello                          2
ed
        ed            Unix,Linux (                              Text file
                 edlin     DOS)
                      ed (fileName)
          ed /home/user/test (           q)
                                              pico         vi
       emacs


emacs
        emacs             Unix,Linux (                              Text file )
                      emacs (fileName)
          emacs /home/user/test (help         Ctrl - h ;          Ctrl - x Ctrl -
c)


exit
        exit           Unix,Linux (
exit
          exit


finger
       finger               Unix,Linux (         User     Login
Who
                     finger [username]
          finger user1                            user1




fsck
       fsck               Unix,Linux (                              Linux file
system
       Scandisk           Dos)
                     fsck [option]
             sbin/fsck -a /dev/hd1


ftp
       ftp            Unix,Linux (
                     ftp (IP or Name of FTP Server )
          ftp 132.209.1.2 [Enter]


Login:anonymous , Password: Username@YourDomain.com
                   ls -           ; pwd - dir.   ;cd -     dir ;lcd -
local dir ;mput* -               ;mget –
       ;bye -
grep
       grep            Unix,Linux (
                     grep (option)
         grep -i ftp /etc/test                        ftp"
                etc/test


groupadd
       groupadd             Unix,Linux (                        User)
                     groupadd (GroupName )
         #groupadd staff                   User     Staff


groupdel
       groupdel             Unix,Linux (                       User)
                     groupadd (GroupName )
         #groupdel staff               User       Staff
gzip/gunzip
       gzip/gunzip            Unix,Linux
(
                     gzip    gunzip (-cdfhlLnNrtv19 ) [file]
                                                --
         #gzip -9vr /home/samba/*                              Sub
/home/samba                            gz
#gunzip -dvr /home/samba/*
gz     Sub /home/samba


halt
       halt            Unix,Linux (
halt [-n] [-w] [-d] [-f] [-I] [-p]
           #halt
                         Shutdown ; init0 , reboot


history
       history                Unix,Linux
(                                     Command line
       F7     DOS                         Dos key)
                       history [n] [-r wan [filename] ]
           #history 20                         20


ifconfig
       history                Unix,Linux
(                                 Network         Lan Card)
                       ifconfig [option]
           #ifconfig


ipchains
       ipchains               Unix,Linux (
                              Firewall)
                       ipchains [parameter] command [option]
           #ipchains -L                   Set IPchains


jobs
       jobs               Unix,Linux (
                              Firewall)
                       jobs
#sleep 20 & jobs


kill
        kill            Unix,Linux (                           Process)
                       kill [option] (process ID)
           ps -A                        PID   Process
Kill -9




login
        login             nnn      nnn                PID -9
Unix,Linux (                                        User Login)
                       login [fp] (UserName)
           #login:root


mkdir
                                   directory (                    dos)
make directory
                    mkdirmkdir [option] [file]
       option                   mkdir
-m                       Permissioin (              chmod
-p                    Parent Directory                                   directory
                   relative
       absolute path


mkdir /home
mkdir -p -m755 ~/home/user1


mv
                                       Directory
                                       dos)
             move
               mv source target
        mv *.tar /backup
mv test.txt old.txt
mv bin oldbin


more
                cat
                      more


               more file
                  more
=
q


h       help
        more test.txt


man
       man              Unix,Linux (


                      man (Command)
        #man ls
q;      Spacebar]                       ;




mount
        mount               Unix,Linux (
                      mount (-t type) DeviceDriverMountPoint
         #        Mount           1 CdRom mount -t iso9660 /dev/cdrom
/mnt/cdrom
#       Mount CdRom               2 mount /dev/cdrom (             mount        CD
mnt/CdRom                        Unmount)


rmdir
                                 directory (                        dos)
remove directory


rmdir [option] [file]
      option                   mkdir        -p              Child          Parent
Directory
directory                    relative            absolute path                  rmdir
/home


tar
                     backup          restore file            tar
directory        file permission
(                                                                     UNIX)
               tape archive
                tar [option]... [file]...
option                   echo
-c                       backup)
-t                                     backup
-v
-f                     file
-x         restore
          tar -xvf data.tar




talk
                                                        2
                          Talk
                talk user[@host] [tty]
                host
ytalk
                2                               tty   Log in
                                       1
          talk m2k@nanastreet.com


write



                write user [tty]
                        write
write
EOF                CTRL+C
       interrupt                                 write
Enter
              write m2k


who am i
                                   login                        login


                              whoami       who am i (    SUN OS         UNIX




file
       file            DOS/Windows
                                                         UNIX


                                                  Context
                       file                Content


                  file [option]... file
              file /bin/sh file report1.doc
free


                 free [-b|-k|-m]
       option               free
-b                          byte
-k                          kilobyte
-m                          megabyte
          free   free –b free -k
pwd
                            Directory                cd
      DOS)              print work directory
                        pwd


uname
                            OS                 cpu
          uname -a


hostname


          hostname


tty
                 terminal
          tty


id


          id
คำสั่งยูนิกส์ Command line
LINUX          UNIX (Linux               2)
1.1          ls :                                        home directory
--------------------------------------------------------------------------------
                account        linux     home directory


linux                                                                           ls
                          parameter                           -al --sort


ls -alt ::
                                       alt
ls -alt | more ::
                                               1
ls -al --sort=time | more ::


ls -R | more ::                              directory


ls      ls -l
             D        Column                                               ls -al
directory
--------------------------------------------------------------------------------
1.2          chmod :                                             Owner),
                Group),          Other)
--------------------------------------------------------------------------------
                 ls                          RWXRWXRWX




                                       webmaster
CGI
                                     CGI              server


                                    Perl
                           x)
                                chmod 755 hello.pl          chmod 775 fileforyou.pl
        chmod +x test.pl                                                3
           R          Read
           W          Write
           X          Execute


--- :                                  0)
--X :                                            1)
R-- :                                   4)
RW- :                                       6)
R-X :                                            5)
RWX :                                                  7)
RWXRWXRWX                              9
3
3
3


RWX------ :                                                    700)
RWXRWX--- :
770)
RWXR-XR-X :
               755)
R--R--R-- :                                           444)
chmod 777 index.php ::                                                             3


chmod 755 * -Rf ::                            direcroty


--------------------------------------------------------------------------------
1.3           man :
               Manual)
--------------------------------------------------------------------------------
                         unix        linux


                  parameter



linux                      man




man man ::                           man
man ls ::                       ls
man useradd ::                           useradd
--------------------------------------------------------------------------------
1.4           mkdir, rmdir, cd :                          directory
--------------------------------------------------------------------------------
                          dos                             directory
                         directory
          3         mkdir                    directory (Make directory) rm
      directory
(Remove directory)                                                            cd
directory (Change directory)


mkdir hello ::            directory        hello
rmdir hello.htm ::                       hello.htm
cd / ::       directory           root
cd .. ::      directory                      1
cd ~/x ::                   x         home directory           home/thaiall/x       home
directory        home/thaiall
--------------------------------------------------------------------------------




1.5              pico :         editor                                  text       vi


--------------------------------------------------------------------------------
                      pico        enter


                                                              ^                         Ctrl


                                                         pico xx
xx
               xx                                  xx
                                             Ctrl-X
                      vi


               pico                                                      pine
                  pico
pine                                  CD                rpm -i pine*
--------------------------------------------------------------------------------
1.6              emacs :           editor                                    text   vi


--------------------------------------------------------------------------------
                           pico
pico
                                     emacs            ctrl-h                        ctrl-x
+ ctrl-c
                                                               pico       editor
                                emacs
                                                               pico
emacs
Welcome to GNU Emacs, one component of a Linux-based
GNU system.
Get help            C-h (Hold down CTRL and press h)
Undo changes              C-x u       Exit Emacs                  C-x C-c
Get a tutorial          C-h t      Use Info to read docs          C-h i
Ordering manuals C-h RET
Activate menubar F10 or ESC ` or M-`
(`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key.
If you have no Meta key, you may instead type ESC followed by the
character.)
--------------------------------------------------------------------------------
1.7              vi :       editor                                    text
--------------------------------------------------------------------------------
Text editor                                 linux
pico                        mail       pine                                    vi
                                              linux                       man
vi


esc
enter
i
a
A
dd
x                   1
cw
:w
:q!
:wq                                               vi
--------------------------------------------------------------------------------
1.8         id, finger, who, w :


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


id uname ::                      account uname
finger uname ::                         account uname
      last login        email
finger @www.isinthai.com ::                                                        login


who |grepthai ::
                                        thai
w ::
--------------------------------------------------------------------------------
1.9         cat :                                       type              DOS
--------------------------------------------------------------------------------


cat /etc/passwd ::                              etc/passwd
cat /etc/passwd | more ::                                etc/passwd
                            passwd suwit:x:500:500:Suwit:/home/suwit:/bin/bash
prasert:x:501:501::
/home/prasert:/bin/bash bcom101:x:502:502::/home/bcom302:/bin/bash
--------------------------------------------------------------------------------
1.10          ifconfig :                          Network interface                   ip
                           server
--------------------------------------------------------------------------------
                                 ifconfig
eth0      Link encap:Ethernet HWaddr 00:20:18:C0:06:C4
inet addr:202.29.78.12 Bcast:202.29.78.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:673054 errors:0 dropped:0 overruns:0 frame:0
TX packets:666268 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:74892865 (71.4 Mb) TX bytes:680121131 (648.6 Mb)
Interrupt:9 Base address:0xcf00
eth0:1     Link encap:Ethernet HWaddr 00:20:18:C0:06:C4
inet addr:202.29.78.1 Bcast:202.29.78.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:9 Base address:0xcf00
     ip          1 ip       #/sbin/ifconfig eth0:1 202.29.78.1
                            IP                                                 9.10
                        etc/rc.d/rc.local
--------------------------------------------------------------------------------
1.11          netstat :
--------------------------------------------------------------------------------
                               netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address                         Foreign Address            State
tcp       0        0 *:mysql                *:*                 LISTEN
tcp       0        0 *:http              *:*                  LISTEN
tcp       0        0 *:ftp               *:*                 LISTEN
tcp       0        0 *:ssh                *:*                  LISTEN
tcp       0        0 *:smtp                 *:*                 LISTEN
tcp       0        0 *:https              *:*                  LISTEN
tcp       0        0 www.isinthai.com:ssh           202.29.78.200:1225             ESTABLI
SHED
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags             Type         State         I-Node Path
unix 2        [ ACC
]     STREAM          LISTENING          855      /var/lib/mysql/mysql.sock
unix 2        [ ACC ]         STREAM           LISTENING        119     /dev/log
unix 2        []        STREAM          CONNECTED              3007
unix 2        []        STREAM          CONNECTED              859
--------------------------------------------------------------------------------
1.12          service :                                                   running


--------------------------------------------------------------------------------
                               service --status-all
httpd (pid 2160 2159 2158 2155 2114 583 579 578 577 576 575 573) is
running...
mysqld (pid 446 429 427 414) is running...
sendmail (pid 1700 1690) is running...
sshd (pid 2970 358) is running...
xinetd (pid 3923 369) is running...




--------------------------------------------------------------------------------
1.13          xinetd :                     xinetd
                           etc/xinetd.d
                                                          talk                     talk
server
--------------------------------------------------------------------------------
                                             xinetd -d
Service configuration: ftp
id = ftp
flags = IPv4
socket_type = stream
Protocol (name,number) = (tcp,6)
Nice = 10
Groups = no
Bind = All addresses.
Server = /usr/sbin/vsftpd
Server argv = vsftpd
Only from: All sites
No access: No blocked sites
Logging to syslog. Facility = authpriv, level = info
Log_on_success flags = HOST PID
Log_on_failure flags = HOST
--------------------------------------------------------------------------------
1.14          whereis :
                                    PATH
                                             find
--------------------------------------------------------------------------------


whereisusermod ::                                   usermod                         run


whereisifconfig ::                               ifconfig
sbin/ifconfig
--------------------------------------------------------------------------------
1.15          cp, rm, mv :
--------------------------------------------------------------------------------


cp x y ::                  x                 y              x
cp
rm y ::            y                                directory
rm -r directoryname ::               directory                  sun
directory                                           confirm
rm -rfdirectoryname ::               directory           Redhat
directory                                           confirm
rm -f * ::                                 yes
mv x /root ::              x                                          root
--------------------------------------------------------------------------------
1.16          ping :              ip                                               internet


ping www.thaiall.com ::                                 www.thaiall.com
IP
ping 202.29.78.100 -c 5 ::                                        5
ping 202.29.78.2 ::                                                           ip
PING 202.29.78.2 (202.29.78.2)
from 202.29.78.12 : 56(84) bytes of data. From 202.29.78.12
icmp_seq=1
Destination Host Unreachable From 202.29.78.12 icmp_seq=2
Destination
Host Unreachable From 202.29.78.12 icmp_seq=3 Destination Host
Unreachable
--------------------------------------------------------------------------------
1.17          env :             environment
--------------------------------------------------------------------------------


env
HISTSIZE=1000
SSH_CLIENT=202.29.78.100 1091 22
OLDPWD=/usr/sbin
QTDIR=/usr/lib/qt3-gcc3.2
SSH_TTY=/dev/pts/0
USER=burin
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;
.... :
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
MAIL=/var/spool/mail/burin
PWD=/etc
INPUTRC=/etc/inputrc
LANG=en_US.UTF-8
HOME=/root
SHLVL=2
LOGNAME=burin
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
--------------------------------------------------------------------------------
1.18          lynx : Text browser                              source         download
--------------------------------------------------------------------------------


lynx www.thaiall.com ::                      www.thaiall.com              text mode
lynx http://www.yonok.ac.th ::                        www.yonok.ac.th                  text
mode
lynx -dump http://www.yonok.ac.th ::                                             interactive
         view
lynx -dump -width=500 http://piology.org/.procmailrc.html|grep '^|'|cut -
c3- ::
--------------------------------------------------------------------------------
1.19          nslookup :                            name server             ip         domain
name
--------------------------------------------------------------------------------
                                                  Redhat
                                            dig        host                  host
yn1.yonok.ac.th            dig yn1.yonok.ac.th
nslookup                                                exit                       >


nslookup 202.28.18.65
Non-authoritative answer:
65.18.28.202.in-addr.arpa name = mars.uni.net.th.
Authoritative answers can be found from:
18.28.202.in-addr.arpa nameserver = mars.uni.net.th.
18.28.202.in-addr.arpa nameserver = ns.netserv.chula.ac.th.
mars.uni.net.th internet address = 202.28.18.65
nslookup www.thaiall.com
Name: www.thaiall.com
Address: 66.150.1.141


--------------------------------------------------------------------------------
1.20          tail :                                                               cat


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


tail index.html ::                           index.html         Current directory
tail --lines=5 /var/log/messages ::                                   var/log/messages
              root
tail /var/log/html/access.log ::                          10                             default


tail --lines=100 /var/log/html/access_log>access_bak ::                              backup
                         mv
--------------------------------------------------------------------------------


1.21          telnet :                 server                  port
server                        telnet          SSH
--------------------------------------------------------------------------------


telnet 202.202.202.202 ::                                202.202.202.202
                  port          port 23
telnet www.school.net.th 21 ::                           port 21            FTP port
telnet mail.loxinfo.co.th 25 ::               smtp
telnet class.yonok.ac.th 110 ::                   pop service           windows server
2003 Microsoft Windows POP3 Service Version 1.0 ready.
USER aa@class.yonok.ac.th +OK PASS xxxxxxx +OK User successfully
logged on
--------------------------------------------------------------------------------
2.1         df :                                          Harddisk
--------------------------------------------------------------------------------
                                              Harddisk
                                                upload
                                                user
server                                         clear


df ::
Filesystem             1K-blocks            Used Available Use% Mounted on
/dev/hda5                505605        82764       396737 18% /
/dev/hda1                101089         9180       86690 10% /boot
/dev/hda3               1423096         41956 1308848 4% /home
none                    30740           0     30740 0% /dev/shm
/dev/hda2               3889924 1551872 2140456 43% /usr
/dev/hda6               1027768        952876          22684 98% /var
--------------------------------------------------------------------------------
2.2         du :                                         directory
--------------------------------------------------------------------------------
                           directory
du ::                         directory
du -all ::                                                                directory
du | sort -g ::                                    directory           sort
                 Kb
du -b ::                          byte          directory
--------------------------------------------------------------------------------


2.3            ps :          Process
--------------------------------------------------------------------------------
                                                                        run



                                                       bot             server


ps ::                   process
ps -ef ::                         process
ps -ax ::                          process
ps -aux ::                          process


--------------------------------------------------------------------------------
2.4            kill :               process                                        process
        kill                 process
--------------------------------------------------------------------------------
                 process
                                                     process                       kill
                                                                                          super
user
kill -9              process ::                process                                 ps -
ef
kill -9 1255 ::       process         1255
--------------------------------------------------------------------------------
2.5         find :                                 directory
--------------------------------------------------------------------------------


find / -name hello.pl ::                       hello.pl          directory
find / -name hello* ::                                           hello
find /bin -size 626188c ::                                   626188                RH8
             bash
--------------------------------------------------------------------------------
2.6         gzip :                                                       gz        z
                               tar                tar.gz
--------------------------------------------------------------------------------


gzip -d x.tar.gz ::                               gz
man gzip ::             gzip
gzip -d radius-1.16.1.tar.Z ::
                ftp.livingston.com/pub/le/radius/


gzip -dc x.tar.Z|tarxvf - ::                                            2
                               gzip      tar      x.tar.z
--------------------------------------------------------------------------------
2.7         tar :                                                      tar
--------------------------------------------------------------------------------
tar xvf x.tar ::                                      tar
directory
tar xvfz squid-2.3-200103110000-src.tar.gz ::                          gz
tar                                gzip              tar
man tar ::             tar
tar zcvf abc.tar.gz /etc ::          copy /etc                  abc.tar.gz
tar zxvf abc.tar.gz ::                      abc.tar.gz              directory
/etc
--------------------------------------------------------------------------------
2.8         last :                        login
--------------------------------------------------------------------------------


last |grep reboot ::                      reboot
last |more ::                  login
--------------------------------------------------------------------------------
2.9         grep :
--------------------------------------------------------------------------------


more /etc/passwd|grepthaiall ::
etc/passwd                                          thaiall
rpm -qa|grep ftp ::                                    ftp
last |grep reboot ::                      reboot
--------------------------------------------------------------------------------
2.10          date :                                                date [OPTION]
[MMDDhhmm[[CC]YY][.ss]]
--------------------------------------------------------------------------------


date +%x ::                                           04/27/01
date +%d ::                                           27
date 04271340 ::                                           27        4        13.40
mmddhhmmccyy)
hwclock --systohc ::                               date         restart
                                                                              hardware
clock                       hardware
--------------------------------------------------------------------------------




2.11          top :
--------------------------------------------------------------------------------


top ::                                                      process
Redhat 8.0


CPU states: 0.5% user, 1.3% system, 0.0% nice, 98.0% idle
Mem:      31328K av, 28872K used,                 2456K free,            0K shrd,    1032K
buff
Swap: 1718912K av,              2608K used, 1716304K free                           16528K
cached
 PID USER             PRI NI SIZE RSS SHARE STAT LIB %CPU
%MEM TIME COMMAND
18306 root         14 0 852 852 672 R                     0 1.5 2.7 0:00 top
18229 root            1 0 1684 1536 1240 S                 0 0.3 4.9 0:00 sshd
1 root       0 0 160 116            92 S         0 0.0 0.3 0:08 init
2 root       0 0        0   0     0 SW        0 0.0 0.0 0:01 kflushd
--------------------------------------------------------------------------------
2.12          ntsysv        setup :
--------------------------------------------------------------------------------


setup ::                                                                    system services
                  server                              httpd, imap, ipop3, iptables,
named, network, sendmail, servers, services, vsftpd, xinetd
web, mail, ftp            dns
ntsysv ::                                        setup, services
(                           RH
--------------------------------------------------------------------------------
2.13          route :
--------------------------------------------------------------------------------


# route
Kernel IP routing table
Destination        Gateway            Genmask                Flags Metric Ref        Use Iface
202.29.78.0           *          255.255.255.0 U               0    0           0 eth0
127.0.0.0         *             255.0.0.0         U      0      0        0 lo
default         202.29.78.254 0.0.0.0                  UG      0     0          0 eth0




--------------------------------------------------------------------------------
2.14          shutdown, reboot :


--------------------------------------------------------------------------------
shutdown -h now                halt ::                                                1


reboot         shutdown -r now ::
                                         clear
--------------------------------------------------------------------------------
2.15          runlevel :                  etc/inittab                              level
                       level                     chkconfig                     2.18
--------------------------------------------------------------------------------


#/sbin/runlevel ::             level
#cat /etc/inittab ::                                                   level
--------------------------------------------------------------------------------
2.16          fsck :                                linux
--------------------------------------------------------------------------------


#fsck / ::             harddisk
harddisk
#fsck /dev/hdc ::                harddisk            dev/hdc         harddisk
--------------------------------------------------------------------------------
2.17          chown, chgrp :
--------------------------------------------------------------------------------
             1.2                chmod                                          3




#chownburin:users x ::                                       x         burin
                       users
#chgrp users y ::                              x           users
--------------------------------------------------------------------------------
2.18           chkconfig :                                                          level


--------------------------------------------------------------------------------
       level                                                  etc/inittab
                                                         level
                             level              start linux      level


# /etc/inittab
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have
networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#id:5:initdefault:
id:3:initdefault:


#/sbin/chkconfig --add mysql ::                      mysql                         system
services
#/sbin/chkconfig --list ::                                                                  level


#/sbin/chkconfig --level 3 sendmail on ::                            sendmail
level 3 (Text mode)
#/sbin/chkconfig --level 5 sendmail on ::                            sendmail
level 5 (X Windows)
--------------------------------------------------------------------------------
2.19          mount, umount :                                    partition         Diskette
       Handy drive
--------------------------------------------------------------------------------
         mount


       harddisk                      server             1
harddisk                          hdc               fdisk -l                partition   1
       hdc               x                                      #mkdir /x
               #mount /dev/hdc1 /x                          x           h

More Related Content

PPT
Raj linux
PPT
Introduction to Unix
DOCX
Linux basic commands
DOC
Some basic unix commands
PPT
3. intro
PPT
8.1.intro unix
PPT
Unix(introduction)
Raj linux
Introduction to Unix
Linux basic commands
Some basic unix commands
3. intro
8.1.intro unix
Unix(introduction)

What's hot (20)

PPT
cisco
PPTX
Unix Linux Commands Presentation 2013
ODP
Linux Introduction (Commands)
PPT
Linux Commands
ODP
Linux commands
PPTX
Linux training
PPT
PPTX
Know the UNIX Commands
PPS
QSpiders - Unix Operating Systems and Commands
PDF
Unix Command Line Productivity Tips
PPTX
Linux Command Suumary
PDF
Quick Guide with Linux Command Line
PPTX
Basic commands of linux
PPT
Basic Unix
PDF
basic-unix.pdf
PPT
PPT
Linux presentation
PDF
Linux commands
PDF
Useful Linux and Unix commands handbook
PPTX
Terminal Commands (Linux - ubuntu) (part-1)
cisco
Unix Linux Commands Presentation 2013
Linux Introduction (Commands)
Linux Commands
Linux commands
Linux training
Know the UNIX Commands
QSpiders - Unix Operating Systems and Commands
Unix Command Line Productivity Tips
Linux Command Suumary
Quick Guide with Linux Command Line
Basic commands of linux
Basic Unix
basic-unix.pdf
Linux presentation
Linux commands
Useful Linux and Unix commands handbook
Terminal Commands (Linux - ubuntu) (part-1)
Ad

Similar to คำสั่งยูนิกส์ Command line (20)

PPSX
Linux: An Unbeaten Empire
PPTX
Presentation for RHCE in linux
PDF
Linux Presentation
PPT
HISTORY, TYPES OF EMBEDDED LINUX, COMMANDS,
PDF
Linux redhat final
DOCX
Unix_commands_theory
PPTX
An Introduction to Linux
PPTX
Basics of-linux
PDF
60761 linux
PPT
Unix fundamentals
PPT
Linux history & features
PPTX
Unix_Introduction_BCA.pptx the very basi
PPT
linux-lecture5 storage fs vm guide for linux.ppt
 
PPT
Linux lecture5
PPTX
Linux powerpoint
PPTX
Ordina Accelerator program 2019 - Linux
PPT
Terminal basic-commands(Unix) -partI
PDF
Raspberry Pi - Lecture 2 Linux OS
PDF
Module 02 Using Linux Command Shell
PPT
Linux Basics
Linux: An Unbeaten Empire
Presentation for RHCE in linux
Linux Presentation
HISTORY, TYPES OF EMBEDDED LINUX, COMMANDS,
Linux redhat final
Unix_commands_theory
An Introduction to Linux
Basics of-linux
60761 linux
Unix fundamentals
Linux history & features
Unix_Introduction_BCA.pptx the very basi
linux-lecture5 storage fs vm guide for linux.ppt
 
Linux lecture5
Linux powerpoint
Ordina Accelerator program 2019 - Linux
Terminal basic-commands(Unix) -partI
Raspberry Pi - Lecture 2 Linux OS
Module 02 Using Linux Command Shell
Linux Basics
Ad

คำสั่งยูนิกส์ Command line

  • 1. Command Line (Linux 1) ls dir DOS) list ls [option] [file] option ls -l Long Format Permission -a -F Directory execute ls –l ls -al ls -F adduser User Unix,Linux adduser -g (group) -d (Directory) (User) adduser -g root -d /home/user1 user User Login user1 root useradd User Unix,Linux ( adduser) useradd -g (group) -d (Directory) (User) useradd -g root -d /home/user1 user User Login user1 root userdel User Unix,Linux userdel [option] (Username) userdel -r root user1 User Login User1 -r
  • 2. Home Directory User1 passwd User Unix,Linux passwd [Username] passwd user1 ( User1 User Unix Login alias Unix,Linux ( SET DOS RUN alias [ alias copy=cp copy cp bash Bourne again shell Unix,Linux bash bash [Enter] ( Bourne again shell) bc Unix,Linux bc [-lwsqv] [option] [file] bc [Enter] 1+2 [Enter] 1^2 [Enter] a=3 [Enter] b=4 [Enter] a*b [Enter] x=2;y=5;x+y[Enter] [Ctrl-d] Install Packet cp copy DOS)
  • 3. copy cp source target #cp test.txt /home/user1 cal Unix,Linux cal cal [Enter]( cal -y [Enter]( cat File Unix,Linux ( Type DOS) cat cat /home/user1 | more home/user1 C Compiler Compile C Unix,Linux ( Type DOS) cc [filename] cc /home/user1/industry.c Compile C industry.c Directory /home/user1 cd
  • 4. Change Directory Unix,Linux ( CD DOS) cd [directory] cd /etc [Enter] Directory etc cd ..[Enter] Directory 1 chfin Change your finger information Unix,Linux ( User chfn [username] chfn User1 User1 chgrp Change Group Unix,Linux ( chgrp [-chfRv] (Group) (File) chgrp root /root/* Group root Group root chmod Change Mode Unix,Linux ( chmod [ File) test chmod 754 test chmod go +r-w test chmod o-r * Mode rwx = 7 ; rw - =6 ; r-x =5 ; r- - = 4 ; - wx = 3 ; - w - = 2 ; - - x =1;--=0 2
  • 5. 1. 2. 2 1 User Group Other = ugo go-r-w+x Run -rwxrwxrwx = Read Write Execute 111 101 100 = 754 Group Execute chown Change Owner Unix,Linux ( chown [ File) chown user1 filename filename User1 chown -R user1.root dirname Sub dirname. chsh chsh Unix,Linux ( Shell User) chsh [Username] chsh user1 [Enter] /bin/bash [Enter] clear
  • 6. clear Unix,Linux ( cls dos) clear clear [Enter] cal Unix,Linux cal cal [Enter]( cal -y [Enter]( mesg mesg status terminal mesg y terminal mesg n terminal date date 17 May 2004 df df Unix,Linux ( df [option] [file] df [Enter] dmesg dmesg Unix,Linux ( Boot)
  • 7. dmesg dmesg | more [Enter] Linux Driver CD- Rom echo echo Unix,Linux ( ECHO DOS) echo ( echo my name is user1 echo Hello > /dev/tty2 Hello 2 ed ed Unix,Linux ( Text file edlin DOS) ed (fileName) ed /home/user/test ( q) pico vi emacs emacs emacs Unix,Linux ( Text file ) emacs (fileName) emacs /home/user/test (help Ctrl - h ; Ctrl - x Ctrl - c) exit exit Unix,Linux (
  • 8. exit exit finger finger Unix,Linux ( User Login Who finger [username] finger user1 user1 fsck fsck Unix,Linux ( Linux file system Scandisk Dos) fsck [option] sbin/fsck -a /dev/hd1 ftp ftp Unix,Linux ( ftp (IP or Name of FTP Server ) ftp 132.209.1.2 [Enter] Login:anonymous , Password: Username@YourDomain.com ls - ; pwd - dir. ;cd - dir ;lcd - local dir ;mput* - ;mget – ;bye -
  • 9. grep grep Unix,Linux ( grep (option) grep -i ftp /etc/test ftp" etc/test groupadd groupadd Unix,Linux ( User) groupadd (GroupName ) #groupadd staff User Staff groupdel groupdel Unix,Linux ( User) groupadd (GroupName ) #groupdel staff User Staff gzip/gunzip gzip/gunzip Unix,Linux ( gzip gunzip (-cdfhlLnNrtv19 ) [file] -- #gzip -9vr /home/samba/* Sub /home/samba gz #gunzip -dvr /home/samba/* gz Sub /home/samba halt halt Unix,Linux (
  • 10. halt [-n] [-w] [-d] [-f] [-I] [-p] #halt Shutdown ; init0 , reboot history history Unix,Linux ( Command line F7 DOS Dos key) history [n] [-r wan [filename] ] #history 20 20 ifconfig history Unix,Linux ( Network Lan Card) ifconfig [option] #ifconfig ipchains ipchains Unix,Linux ( Firewall) ipchains [parameter] command [option] #ipchains -L Set IPchains jobs jobs Unix,Linux ( Firewall) jobs
  • 11. #sleep 20 & jobs kill kill Unix,Linux ( Process) kill [option] (process ID) ps -A PID Process Kill -9 login login nnn nnn PID -9 Unix,Linux ( User Login) login [fp] (UserName) #login:root mkdir directory ( dos) make directory mkdirmkdir [option] [file] option mkdir -m Permissioin ( chmod -p Parent Directory directory relative absolute path mkdir /home
  • 12. mkdir -p -m755 ~/home/user1 mv Directory dos) move mv source target mv *.tar /backup mv test.txt old.txt mv bin oldbin more cat more more file more = q h help more test.txt man man Unix,Linux ( man (Command) #man ls
  • 13. q; Spacebar] ; mount mount Unix,Linux ( mount (-t type) DeviceDriverMountPoint # Mount 1 CdRom mount -t iso9660 /dev/cdrom /mnt/cdrom # Mount CdRom 2 mount /dev/cdrom ( mount CD mnt/CdRom Unmount) rmdir directory ( dos) remove directory rmdir [option] [file] option mkdir -p Child Parent Directory directory relative absolute path rmdir /home tar backup restore file tar directory file permission ( UNIX) tape archive tar [option]... [file]...
  • 14. option echo -c backup) -t backup -v -f file -x restore tar -xvf data.tar talk 2 Talk talk user[@host] [tty] host ytalk 2 tty Log in 1 talk m2k@nanastreet.com write write user [tty] write
  • 15. write EOF CTRL+C interrupt write Enter write m2k who am i login login whoami who am i ( SUN OS UNIX file file DOS/Windows UNIX Context file Content file [option]... file file /bin/sh file report1.doc
  • 16. free free [-b|-k|-m] option free -b byte -k kilobyte -m megabyte free free –b free -k pwd Directory cd DOS) print work directory pwd uname OS cpu uname -a hostname hostname tty terminal tty id id
  • 18. LINUX UNIX (Linux 2) 1.1 ls : home directory -------------------------------------------------------------------------------- account linux home directory linux ls parameter -al --sort ls -alt :: alt ls -alt | more :: 1 ls -al --sort=time | more :: ls -R | more :: directory ls ls -l D Column ls -al directory -------------------------------------------------------------------------------- 1.2 chmod : Owner), Group), Other) -------------------------------------------------------------------------------- ls RWXRWXRWX webmaster
  • 19. CGI CGI server Perl x) chmod 755 hello.pl chmod 775 fileforyou.pl chmod +x test.pl 3 R Read W Write X Execute --- : 0) --X : 1) R-- : 4) RW- : 6) R-X : 5) RWX : 7) RWXRWXRWX 9 3 3 3 RWX------ : 700) RWXRWX--- : 770) RWXR-XR-X : 755) R--R--R-- : 444)
  • 20. chmod 777 index.php :: 3 chmod 755 * -Rf :: direcroty -------------------------------------------------------------------------------- 1.3 man : Manual) -------------------------------------------------------------------------------- unix linux parameter linux man man man :: man man ls :: ls man useradd :: useradd -------------------------------------------------------------------------------- 1.4 mkdir, rmdir, cd : directory -------------------------------------------------------------------------------- dos directory directory 3 mkdir directory (Make directory) rm directory (Remove directory) cd
  • 21. directory (Change directory) mkdir hello :: directory hello rmdir hello.htm :: hello.htm cd / :: directory root cd .. :: directory 1 cd ~/x :: x home directory home/thaiall/x home directory home/thaiall -------------------------------------------------------------------------------- 1.5 pico : editor text vi -------------------------------------------------------------------------------- pico enter ^ Ctrl pico xx xx xx xx Ctrl-X vi pico pine pico pine CD rpm -i pine*
  • 22. -------------------------------------------------------------------------------- 1.6 emacs : editor text vi -------------------------------------------------------------------------------- pico pico emacs ctrl-h ctrl-x + ctrl-c pico editor emacs pico emacs Welcome to GNU Emacs, one component of a Linux-based GNU system. Get help C-h (Hold down CTRL and press h) Undo changes C-x u Exit Emacs C-x C-c Get a tutorial C-h t Use Info to read docs C-h i Ordering manuals C-h RET Activate menubar F10 or ESC ` or M-` (`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key. If you have no Meta key, you may instead type ESC followed by the character.) -------------------------------------------------------------------------------- 1.7 vi : editor text -------------------------------------------------------------------------------- Text editor linux pico mail pine vi linux man
  • 23. vi esc enter i a A dd x 1 cw :w :q! :wq vi -------------------------------------------------------------------------------- 1.8 id, finger, who, w : -------------------------------------------------------------------------------- id uname :: account uname finger uname :: account uname last login email finger @www.isinthai.com :: login who |grepthai :: thai w :: -------------------------------------------------------------------------------- 1.9 cat : type DOS
  • 24. -------------------------------------------------------------------------------- cat /etc/passwd :: etc/passwd cat /etc/passwd | more :: etc/passwd passwd suwit:x:500:500:Suwit:/home/suwit:/bin/bash prasert:x:501:501:: /home/prasert:/bin/bash bcom101:x:502:502::/home/bcom302:/bin/bash -------------------------------------------------------------------------------- 1.10 ifconfig : Network interface ip server -------------------------------------------------------------------------------- ifconfig eth0 Link encap:Ethernet HWaddr 00:20:18:C0:06:C4 inet addr:202.29.78.12 Bcast:202.29.78.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:673054 errors:0 dropped:0 overruns:0 frame:0 TX packets:666268 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:74892865 (71.4 Mb) TX bytes:680121131 (648.6 Mb) Interrupt:9 Base address:0xcf00 eth0:1 Link encap:Ethernet HWaddr 00:20:18:C0:06:C4 inet addr:202.29.78.1 Bcast:202.29.78.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:9 Base address:0xcf00 ip 1 ip #/sbin/ifconfig eth0:1 202.29.78.1 IP 9.10 etc/rc.d/rc.local --------------------------------------------------------------------------------
  • 25. 1.11 netstat : -------------------------------------------------------------------------------- netstat -a Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:mysql *:* LISTEN tcp 0 0 *:http *:* LISTEN tcp 0 0 *:ftp *:* LISTEN tcp 0 0 *:ssh *:* LISTEN tcp 0 0 *:smtp *:* LISTEN tcp 0 0 *:https *:* LISTEN tcp 0 0 www.isinthai.com:ssh 202.29.78.200:1225 ESTABLI SHED Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path unix 2 [ ACC ] STREAM LISTENING 855 /var/lib/mysql/mysql.sock unix 2 [ ACC ] STREAM LISTENING 119 /dev/log unix 2 [] STREAM CONNECTED 3007 unix 2 [] STREAM CONNECTED 859 -------------------------------------------------------------------------------- 1.12 service : running -------------------------------------------------------------------------------- service --status-all httpd (pid 2160 2159 2158 2155 2114 583 579 578 577 576 575 573) is running... mysqld (pid 446 429 427 414) is running...
  • 26. sendmail (pid 1700 1690) is running... sshd (pid 2970 358) is running... xinetd (pid 3923 369) is running... -------------------------------------------------------------------------------- 1.13 xinetd : xinetd etc/xinetd.d talk talk server -------------------------------------------------------------------------------- xinetd -d Service configuration: ftp id = ftp flags = IPv4 socket_type = stream Protocol (name,number) = (tcp,6) Nice = 10 Groups = no Bind = All addresses. Server = /usr/sbin/vsftpd Server argv = vsftpd Only from: All sites No access: No blocked sites Logging to syslog. Facility = authpriv, level = info Log_on_success flags = HOST PID Log_on_failure flags = HOST
  • 27. -------------------------------------------------------------------------------- 1.14 whereis : PATH find -------------------------------------------------------------------------------- whereisusermod :: usermod run whereisifconfig :: ifconfig sbin/ifconfig -------------------------------------------------------------------------------- 1.15 cp, rm, mv : -------------------------------------------------------------------------------- cp x y :: x y x cp rm y :: y directory rm -r directoryname :: directory sun directory confirm rm -rfdirectoryname :: directory Redhat directory confirm rm -f * :: yes mv x /root :: x root -------------------------------------------------------------------------------- 1.16 ping : ip internet ping www.thaiall.com :: www.thaiall.com IP
  • 28. ping 202.29.78.100 -c 5 :: 5 ping 202.29.78.2 :: ip PING 202.29.78.2 (202.29.78.2) from 202.29.78.12 : 56(84) bytes of data. From 202.29.78.12 icmp_seq=1 Destination Host Unreachable From 202.29.78.12 icmp_seq=2 Destination Host Unreachable From 202.29.78.12 icmp_seq=3 Destination Host Unreachable -------------------------------------------------------------------------------- 1.17 env : environment -------------------------------------------------------------------------------- env HISTSIZE=1000 SSH_CLIENT=202.29.78.100 1091 22 OLDPWD=/usr/sbin QTDIR=/usr/lib/qt3-gcc3.2 SSH_TTY=/dev/pts/0 USER=burin LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40; .... : PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin MAIL=/var/spool/mail/burin PWD=/etc INPUTRC=/etc/inputrc LANG=en_US.UTF-8 HOME=/root
  • 29. SHLVL=2 LOGNAME=burin LESSOPEN=|/usr/bin/lesspipe.sh %s G_BROKEN_FILENAMES=1 _=/bin/env -------------------------------------------------------------------------------- 1.18 lynx : Text browser source download -------------------------------------------------------------------------------- lynx www.thaiall.com :: www.thaiall.com text mode lynx http://www.yonok.ac.th :: www.yonok.ac.th text mode lynx -dump http://www.yonok.ac.th :: interactive view lynx -dump -width=500 http://piology.org/.procmailrc.html|grep '^|'|cut - c3- :: -------------------------------------------------------------------------------- 1.19 nslookup : name server ip domain name -------------------------------------------------------------------------------- Redhat dig host host yn1.yonok.ac.th dig yn1.yonok.ac.th nslookup exit > nslookup 202.28.18.65 Non-authoritative answer: 65.18.28.202.in-addr.arpa name = mars.uni.net.th.
  • 30. Authoritative answers can be found from: 18.28.202.in-addr.arpa nameserver = mars.uni.net.th. 18.28.202.in-addr.arpa nameserver = ns.netserv.chula.ac.th. mars.uni.net.th internet address = 202.28.18.65 nslookup www.thaiall.com Name: www.thaiall.com Address: 66.150.1.141 -------------------------------------------------------------------------------- 1.20 tail : cat -------------------------------------------------------------------------------- tail index.html :: index.html Current directory tail --lines=5 /var/log/messages :: var/log/messages root tail /var/log/html/access.log :: 10 default tail --lines=100 /var/log/html/access_log>access_bak :: backup mv -------------------------------------------------------------------------------- 1.21 telnet : server port server telnet SSH -------------------------------------------------------------------------------- telnet 202.202.202.202 :: 202.202.202.202 port port 23
  • 31. telnet www.school.net.th 21 :: port 21 FTP port telnet mail.loxinfo.co.th 25 :: smtp telnet class.yonok.ac.th 110 :: pop service windows server 2003 Microsoft Windows POP3 Service Version 1.0 ready. USER aa@class.yonok.ac.th +OK PASS xxxxxxx +OK User successfully logged on -------------------------------------------------------------------------------- 2.1 df : Harddisk -------------------------------------------------------------------------------- Harddisk upload user server clear df :: Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda5 505605 82764 396737 18% / /dev/hda1 101089 9180 86690 10% /boot /dev/hda3 1423096 41956 1308848 4% /home none 30740 0 30740 0% /dev/shm /dev/hda2 3889924 1551872 2140456 43% /usr /dev/hda6 1027768 952876 22684 98% /var -------------------------------------------------------------------------------- 2.2 du : directory -------------------------------------------------------------------------------- directory
  • 32. du :: directory du -all :: directory du | sort -g :: directory sort Kb du -b :: byte directory -------------------------------------------------------------------------------- 2.3 ps : Process -------------------------------------------------------------------------------- run bot server ps :: process ps -ef :: process ps -ax :: process ps -aux :: process -------------------------------------------------------------------------------- 2.4 kill : process process kill process -------------------------------------------------------------------------------- process process kill super user
  • 33. kill -9 process :: process ps - ef kill -9 1255 :: process 1255 -------------------------------------------------------------------------------- 2.5 find : directory -------------------------------------------------------------------------------- find / -name hello.pl :: hello.pl directory find / -name hello* :: hello find /bin -size 626188c :: 626188 RH8 bash -------------------------------------------------------------------------------- 2.6 gzip : gz z tar tar.gz -------------------------------------------------------------------------------- gzip -d x.tar.gz :: gz man gzip :: gzip gzip -d radius-1.16.1.tar.Z :: ftp.livingston.com/pub/le/radius/ gzip -dc x.tar.Z|tarxvf - :: 2 gzip tar x.tar.z -------------------------------------------------------------------------------- 2.7 tar : tar --------------------------------------------------------------------------------
  • 34. tar xvf x.tar :: tar directory tar xvfz squid-2.3-200103110000-src.tar.gz :: gz tar gzip tar man tar :: tar tar zcvf abc.tar.gz /etc :: copy /etc abc.tar.gz tar zxvf abc.tar.gz :: abc.tar.gz directory /etc -------------------------------------------------------------------------------- 2.8 last : login -------------------------------------------------------------------------------- last |grep reboot :: reboot last |more :: login -------------------------------------------------------------------------------- 2.9 grep : -------------------------------------------------------------------------------- more /etc/passwd|grepthaiall :: etc/passwd thaiall rpm -qa|grep ftp :: ftp last |grep reboot :: reboot -------------------------------------------------------------------------------- 2.10 date : date [OPTION] [MMDDhhmm[[CC]YY][.ss]] -------------------------------------------------------------------------------- date +%x :: 04/27/01
  • 35. date +%d :: 27 date 04271340 :: 27 4 13.40 mmddhhmmccyy) hwclock --systohc :: date restart hardware clock hardware -------------------------------------------------------------------------------- 2.11 top : -------------------------------------------------------------------------------- top :: process Redhat 8.0 CPU states: 0.5% user, 1.3% system, 0.0% nice, 98.0% idle Mem: 31328K av, 28872K used, 2456K free, 0K shrd, 1032K buff Swap: 1718912K av, 2608K used, 1716304K free 16528K cached PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 18306 root 14 0 852 852 672 R 0 1.5 2.7 0:00 top 18229 root 1 0 1684 1536 1240 S 0 0.3 4.9 0:00 sshd 1 root 0 0 160 116 92 S 0 0.0 0.3 0:08 init 2 root 0 0 0 0 0 SW 0 0.0 0.0 0:01 kflushd --------------------------------------------------------------------------------
  • 36. 2.12 ntsysv setup : -------------------------------------------------------------------------------- setup :: system services server httpd, imap, ipop3, iptables, named, network, sendmail, servers, services, vsftpd, xinetd web, mail, ftp dns ntsysv :: setup, services ( RH -------------------------------------------------------------------------------- 2.13 route : -------------------------------------------------------------------------------- # route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 202.29.78.0 * 255.255.255.0 U 0 0 0 eth0 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default 202.29.78.254 0.0.0.0 UG 0 0 0 eth0 -------------------------------------------------------------------------------- 2.14 shutdown, reboot : --------------------------------------------------------------------------------
  • 37. shutdown -h now halt :: 1 reboot shutdown -r now :: clear -------------------------------------------------------------------------------- 2.15 runlevel : etc/inittab level level chkconfig 2.18 -------------------------------------------------------------------------------- #/sbin/runlevel :: level #cat /etc/inittab :: level -------------------------------------------------------------------------------- 2.16 fsck : linux -------------------------------------------------------------------------------- #fsck / :: harddisk harddisk #fsck /dev/hdc :: harddisk dev/hdc harddisk -------------------------------------------------------------------------------- 2.17 chown, chgrp : -------------------------------------------------------------------------------- 1.2 chmod 3 #chownburin:users x :: x burin users
  • 38. #chgrp users y :: x users -------------------------------------------------------------------------------- 2.18 chkconfig : level -------------------------------------------------------------------------------- level etc/inittab level level start linux level # /etc/inittab # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) #id:5:initdefault: id:3:initdefault: #/sbin/chkconfig --add mysql :: mysql system services #/sbin/chkconfig --list :: level #/sbin/chkconfig --level 3 sendmail on :: sendmail level 3 (Text mode)
  • 39. #/sbin/chkconfig --level 5 sendmail on :: sendmail level 5 (X Windows) -------------------------------------------------------------------------------- 2.19 mount, umount : partition Diskette Handy drive -------------------------------------------------------------------------------- mount harddisk server 1 harddisk hdc fdisk -l partition 1 hdc x #mkdir /x #mount /dev/hdc1 /x x h