command unix เบื้องต้น

29
เมษายน 08, 2014, 12:11:46 AM ยินดีต้อนรับคุณ, บุคคลท ั วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน ส่งอีเมล์ยืนยันการใช้งาน? เข้าสู่ระบบด้วยชื อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั ข่าว: >> Stocks IM Fan เปิ ดเเล้ว ที นี << หน้าแรก ช่วยเหลือ เข้าสู ่ระบบ สมัครสมาชิก Marketing For Internet Marketing > Internet Marketing > Hosting & Domain > Command Unix เบื องต้น (ฉบ ับภาษาไทย) หน้า: [1] ลงล่าง « หน้าที แล ้ว ต่อไป » พิมพ์ ผู้เขียน หัวข้อ: Command Unix เบื องต้น (ฉบับภาษาไทย) (อ่าน 363 ครั ) 0 สมาชิก และ 1 บุคคลทั วไป กําลังดูหัวข้อนี onearth99 MD Like: 127 ออฟไลน์ กระทู้ : 764 Command Unix เบื องต้น (ฉบับภาษาไทย) « เมื : กุมภาพันธ์ 17, 2012, 10:01:22 AM » คําสั งยูนิกส์ 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 Command Unix เบื องต ้น (ฉบับภาษาไทย) http://www.mk4im.com/index.php?topic=1825.0 1 of 29 4/8/2014 12:12 AM

Upload: sanyahv

Post on 25-Nov-2015

88 views

Category:

Documents


4 download

DESCRIPTION

Fundamental Unix Command - Thai Lang

TRANSCRIPT

  • 08, 2014, 12:11:46 AM , ?

    : >> Stocks IM Fan Internet Marketing > Hosting &Domain > Command Unix ()

    : [1]

    : Command Unix () ( 363 )

    0 1 onearth99MD

    Like: 127

    : 764

    Command Unix () : 17, 2012, 10:01:22 AM

    Command Line (Linux 1) ls ( dirDOS) list ls [option] [file]option ls -l Long Format Permission -a -F / Directory * execute ls l ls -al ls -Fadduser User Unix,Linux adduser -g (group) -d (Directory) (User) adduser -g root -d /home/user1 user User Login user1 rootuseradd

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    1 of 29 4/8/2014 12:12 AM

  • User Unix,Linux ( adduser) useradd -g (group) -d (Directory) (User) useradd -g root -d /home/user1 user User Login user1 rootuserdel 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 UserUnixLogin)alias Unix,Linux ( SETDOS 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 (copyDOS) copy cp source target #cp test.txt /home/user1cal Unix,Linux cal cal [Enter]( )cal -y [Enter]( )catFile Unix,Linux (Type

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    2 of 29 4/8/2014 12:12 AM

  • DOS) cat cat /home/user1 | more /home/user1C CompilerCompile C Unix,Linux (TypeDOS) cc [filename] cc /home/user1/industry.c Compile C industry.c Directory /home/user1cdChange Directory Unix,Linux (CDDOS) cd [directory] cd /etc [Enter]Directory etccd ..[Enter] Directory1 chfinChange your finger information Unix,Linux (User ) chfn [username] chfn User1 User1chgrpChange Group Unix,Linux () chgrp [-chfRv] (Group) (File) chgrp root /root/* Group/root Group rootchmodChange Mode Unix,Linux () chmod [] (File) test chmod 754 test chmodgo +r-w test chmod o-r *Mode rwx = 7 ; rw - =6 ; r-x =5 ; r- - = 4 ; - wx = 3 ; - w- = 2 ; - - x = 1 ; - - = 021.2.2 (1 ) User Group Other = ugo go-r-w+x Run -rwx rwx rwx = Read Write Execute 111 101 100 = 754 GroupExecute

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    3 of 29 4/8/2014 12:12 AM

  • chownChange Owner Unix,Linux () chown [] (File) chown user1 filename filenameUser1chown -R user1.root dirname Sub dirname.chshchsh Unix,Linux (Shell User) chsh [Username] chsh user1 [Enter] /bin/bash [Enter]clearclear Unix,Linux ( cls dos) clear clear [Enter]cal Unix,Linux cal cal [Enter]( )cal -y [Enter]( )mesgmesg status terminalmesg y terminal mesg n terminal date date 17 May 2004dfdf Unix,Linux ()df [option] [file] df [Enter]dmesgdmesg Unix,Linux ( Boot) dmesg dmesg | more [Enter] Linux DriverCD-Rom echoecho Unix,Linux ( ECHODOS)

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    4 of 29 4/8/2014 12:12 AM

  • echo () echo my name is user1echo Hello > /dev/tty2 Hello 2ed ed Unix,Linux ( Text file edlinDOS) ed (fileName) ed /home/user/test (q) picovi emacsemacs emacs Unix,Linux ( Text file ) emacs (fileName) emacs /home/user/test (help Ctrl - h ; Ctrl - xCtrl - c)exit exit Unix,Linux ( ) exit exitfinger finger Unix,Linux (UserLogin Who) finger [username] finger user1 user1fsck fsck Unix,Linux ( Linuxfile system Scandisk Dos) fsck [option] /sbin/fsck -a /dev/hd1ftp ftp Unix,Linux (- ) ftp (IP or Name of FTP Server ) ftp 132.209.1.2 [Enter]Login:anonymous , Password: [email protected] ls - ; pwd -dir. ;cd - dir ;lcd - local dir ;mput* - ;mget ;bye - grep grep Unix,Linux ( ) grep (option) grep -i ftp /etc/test "ftp"

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    5 of 29 4/8/2014 12:12 AM

  • - /etc/testgroupadd groupadd Unix,Linux ( User) groupadd (GroupName ) #groupadd staff User Staff groupdel groupdel Unix,Linux ( User) groupadd (GroupName ) #groupdel staff User Staffgzip/gunzipgzip/gunzip Unix,Linux () gzipgunzip (-cdfhlLnNrtv19 ) [file] #gzip -9vr /home/samba/* Sub/home/samba .gz#gunzip -dvr /home/samba/* .gz Sub /home/sambahalt halt Unix,Linux () halt [-n] [-w] [-d] [-f] [-I] [-p] #halt Shutdown ; init0 , reboothistory history Unix,Linux (Command line F7DOSDos key)history [n] [-r wan [filename] ] #history 20 20ifconfig history Unix,Linux (NetworkLan Card) ifconfig [option] #ifconfigipchains ipchains Unix,Linux ( Firewall) ipchains [parameter] command [option] #ipchains -L Set IPchainsjobs jobs Unix,Linux ( Firewall)

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    6 of 29 4/8/2014 12:12 AM

  • jobs #sleep 20 & jobskill kill Unix,Linux ( Process) kill [option] (process ID) ps -A PIDProcess Kill -9login login nnn nnnPID -9 Unix,Linux ( User Login) login [fp] (UserName) #login:rootmkdir directory ( dos) make directorymkdir mkdir [option] [file] option mkdir -m Permissioin ( chmod )-p Parent Directory directory relative absolute path mkdir /homemkdir -p -m755 ~/home/user1mv Directory ( dos) move mv source target mv *.tar /backupmv test.txt old.txtmv bin oldbinmore cat more more file more = q h help more test.txt

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    7 of 29 4/8/2014 12:12 AM

  • man man Unix,Linux ( )man (Command) #man ls q ;-b|-k|-m] option free -b byte-k kilobyte-m megabyte free free b free -kpwd Directory ( cd DOS) print work directory / pwduname OS cpu uname -ahostname hostnametty terminal ttyid idSource : http://www.ensthai.com/tip_trick/page/unix_command_p1.php LINUX UNIX (Linux 2) 1.1 ls : home directory-------------------------------------------------------------------------------- account linux home directory linux ls parameter -al --sort

    ls -alt ::

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    8 of 29 4/8/2014 12:12 AM

  • 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 775fileforyou.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)

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    9 of 29 4/8/2014 12:12 AM

  • chmod 777 index.php :: 3chmod 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.htmcd / :: 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

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    10 of 29 4/8/2014 12:12 AM

  • 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 GNUsystem.Get help C-h (Hold down CTRL and press h)Undo changes C-x u Exit Emacs C-x C-cGet a tutorial C-h t Use Info to read docs C-h iOrdering manuals C-h RETActivate menubar F10 or ESC ` or M-`(`C-' means use the CTRL key. `M-' means use the Meta (orAlt) key.If you have no Meta key, you may instead type ESC followed bythe 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

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    11 of 29 4/8/2014 12:12 AM

  • :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 |grep thai :: thaiw :: --------------------------------------------------------------------------------1.9 cat : type DOS-------------------------------------------------------------------------------- cat /etc/passwd :: /etc/passwdcat /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 -------------------------------------------------------------------------------- ifconfigeth0 Link encap:Ethernet HWaddr 00:20:18:C0:06:C4inet addr:202.29.78.12 Bcast:202.29.78.255 Mask:255.255.255.0UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:673054 errors:0 dropped:0 overruns:0 frame:0TX packets:666268 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:100RX bytes:74892865 (71.4 Mb) TX bytes:680121131 (648.6 Mb)Interrupt:9 Base address:0xcf00eth0:1 Link encap:Ethernet HWaddr 00:20:18:C0:06:C4inet addr:202.29.78.1 Bcast:202.29.78.255

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    12 of 29 4/8/2014 12:12 AM

  • Mask:255.255.255.0UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1Interrupt: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 -aActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 *:mysql *:* LISTENtcp 0 0 *:http *:* LISTENtcp 0 0 *:ftp *:* LISTENtcp 0 0 *:ssh *:* LISTENtcp 0 0 *:smtp *:* LISTENtcp 0 0 *:https *:* LISTENtcp 0 0 www.isinthai.com:ssh 202.29.78.200:1225 ESTABLISHEDActive UNIX domain sockets (servers and established)Proto RefCnt Flags Type State I-Node Pathunix 2 [ ACC ] STREAM LISTENING 855 /var/lib/mysql/mysql.sockunix 2 [ ACC ] STREAM LISTENING 119 /dev/logunix 2 [ ] STREAM CONNECTED 3007unix 2 [ ] STREAM CONNECTED 859

    --------------------------------------------------------------------------------1.12 service : running -------------------------------------------------------------------------------- service --status-allhttpd (pid 2160 2159 2158 2155 2114 583 579 578 577 576575 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

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    13 of 29 4/8/2014 12:12 AM

  • /etc/xinetd.d talk talk server -------------------------------------------------------------------------------- xinetd -dService configuration: ftpid = ftpflags = IPv4socket_type = streamProtocol (name,number) = (tcp,6)Nice = 10Groups = noBind = All addresses.Server = /usr/sbin/vsftpdServer argv = vsftpdOnly from: All sitesNo access: No blocked sitesLogging to syslog. Facility = authpriv, level = infoLog_on_success flags = HOST PIDLog_on_failure flags = HOST

    --------------------------------------------------------------------------------1.14 whereis : PATH find-------------------------------------------------------------------------------- whereis usermod :: usermod run whereis ifconfig :: ifconfig /sbin/ifconfig --------------------------------------------------------------------------------1.15 cp, rm, mv : -------------------------------------------------------------------------------- cp x y :: x y x cprm y :: y directory rm -r directoryname :: directory sun directory confirm rm -rf directoryname :: directory Redhat directory confirm rm -f * :: yesmv x /root :: x /root

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    14 of 29 4/8/2014 12:12 AM

  • --------------------------------------------------------------------------------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.12icmp_seq=1Destination Host Unreachable From 202.29.78.12 icmp_seq=2DestinationHost Unreachable From 202.29.78.12 icmp_seq=3 DestinationHost Unreachable--------------------------------------------------------------------------------1.17 env : environment -------------------------------------------------------------------------------- envHISTSIZE=1000SSH_CLIENT=202.29.78.100 1091 22OLDPWD=/usr/sbinQTDIR=/usr/lib/qt3-gcc3.2SSH_TTY=/dev/pts/0USER=burinLS_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/binMAIL=/var/spool/mail/burinPWD=/etcINPUTRC=/etc/inputrcLANG=en_US.UTF-8HOME=/rootSHLVL=2LOGNAME=burinLESSOPEN=|/usr/bin/lesspipe.sh %sG_BROKEN_FILENAMES=1_=/bin/env--------------------------------------------------------------------------------1.18 lynx : Text browser source download --------------------------------------------------------------------------------

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    15 of 29 4/8/2014 12:12 AM

  • lynx www.thaiall.com :: www.thaiall.com textmodelynx http://www.yonok.ac.th :: www.yonok.ac.th text modelynx -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.65Non-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.65nslookup www.thaiall.comName: www.thaiall.comAddress: 66.150.1.141

    --------------------------------------------------------------------------------1.20 tail : cat -------------------------------------------------------------------------------- tail index.html :: index.html Current directorytail --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

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    16 of 29 4/8/2014 12:12 AM

  • server telnet SSH -------------------------------------------------------------------------------- telnet 202.202.202.202 :: 202.202.202.202 port port 23telnet www.school.net.th 21 :: port 21 FTPporttelnet mail.loxinfo.co.th 25 :: smtp telnet class.yonok.ac.th 110 :: pop service windowsserver 2003 Microsoft Windows POP3 Service Version 1.0 ready.USER [email protected] +OK PASS xxxxxxx +OK Usersuccessfully logged on--------------------------------------------------------------------------------2.1 df : Harddisk -------------------------------------------------------------------------------- Harddisk upload user ( server clear ) df :: Filesystem 1K-blocks Used Available Use% Mountedon/dev/hda5 505605 82764 : 17, 2012,10:07:52 AM onearth99

    Work Hard, Play Hard, Travel Hard

    onearth99MD

    Like: 127

    : 764

    Re: Command Unix () #1 : 17, 2012, 10:02:27 AM

    --------------------------------------------------------------------------------2.1 df : Harddisk -------------------------------------------------------------------------------- Harddisk upload user ( server clear ) df :: Filesystem 1K-blocks Used Available Use% Mountedon/dev/hda5 505605 82764 396737 18% //dev/hda1 101089 9180 86690 10% /boot/dev/hda3 1423096 41956 1308848 4% /homenone 30740 0 30740 0% /dev/shm

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    17 of 29 4/8/2014 12:12 AM

  • /dev/hda2 3889924 1551872 2140456 43% /usr/dev/hda6 1027768 952876 22684 98% /var--------------------------------------------------------------------------------2.2 du : directory -------------------------------------------------------------------------------- directory du :: directory du -all :: directorydu | sort -g :: directory sort Kbdu -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 --------------------------------------------------------------------------------

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    18 of 29 4/8/2014 12:12 AM

  • find / -name hello.pl :: hello.pl directoryfind / -name hello* :: hellofind /bin -size 626188c :: 626188 RH8 bash--------------------------------------------------------------------------------2.6 gzip : gz z tar .tar.gz-------------------------------------------------------------------------------- gzip -d x.tar.gz :: gzman gzip :: gzip gzip -d radius-1.16.1.tar.Z :: ftp.livingston.com/pub/le/radius/ gzip -dc x.tar.Z|tar xvf - :: 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 tarman 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|grep thaiall :: /etc/passwd thaiallrpm -qa|grep ftp :: ftp

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    19 of 29 4/8/2014 12:12 AM

  • 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.0CPU states: 0.5% user, 1.3% system, 0.0% nice, 98.0% idleMem: 31328K av, 28872K used, 2456K free, 0K shrd, 1032K buffSwap: 1718912K av, 2608K used, 1716304K free 16528K cached PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU%MEM TIME COMMAND18306 root 14 0 852 852 672 R 0 1.5 2.7 0:00top18229 root 1 0 1684 1536 1240 S 0 0.3 4.9 0:00sshd1 root 0 0 160 116 92 S 0 0.0 0.3 0:08 init2 root 0 0 0 0 0 SW 0 0.0 0.0 0:01 kflushd

    --------------------------------------------------------------------------------2.12 ntsysv setup : - -------------------------------------------------------------------------------- setup :: systemservices server httpd, imap, ipop3,iptables, named, network, sendmail, servers, services, vsftpd,xinetd web, mail, ftp dns

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    20 of 29 4/8/2014 12:12 AM

  • ntsysv :: - setup, services ( RH )--------------------------------------------------------------------------------2.13 route : -------------------------------------------------------------------------------- # routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface202.29.78.0 * 255.255.255.0 U 0 0 0eth0127.0.0.0 * 255.0.0.0 U 0 0 0 lodefault 202.29.78.254 0.0.0.0 UG 0 0 0eth0

    --------------------------------------------------------------------------------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

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    21 of 29 4/8/2014 12:12 AM

  • --------------------------------------------------------------------------------2.17 chown, chgrp : -------------------------------------------------------------------------------- 1.2 chmod 3 #chown burin: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 nothave 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

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    22 of 29 4/8/2014 12:12 AM

  • harddisk server 1 harddisk hdc fdisk-l partition 1 hdc /x #mkdir /x #mount /dev/hdc1 /x /x harddisk mount#cat /etc/fstab : file system table mount #cat /etc/mtab : mount #cat /proc/mounts : mount #cat /proc/partitions : partitions#cat /proc/filesystems : filesystems #/sbin/fdisk -l : partition harddisk #mount --bind /var/www /home/yourname/www#mount mount Floppy Disk linux#mkdir /floppy#mkfs -t ext3 /dev/fd0 1440#mount -t ext3 /dev/fd0 /floppy- or -#mkdir /floppy#mkfs -t msdos /dev/fd0 1440#mount -t msdos /dev/fd0 /floppy /floppy disk drive A /dev/fd1 driveB Handy Drive Apacer ( umount apacer )#mkdir /mnt/apacer (Just first time)#mount /dev/sda1 /mnt/apacer...#cd /#umount /dev/sda1- and -#pico /etc/fstab Add: /dev/sda1 /mnt/apacer auto noauto,user0 0 Partition WindowsXPcd / :: root directorymkdir hd :: hd fdisk -l :: partition mount /hdmount /dev/hdb2 /hd :: /dev/hdb2 /hd cd/hd/etc hdb2 etcumount /hd :: mount /hd CDROMmount :: mount

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    23 of 29 4/8/2014 12:12 AM

  • mount -t ext3 :: partition ext3 mountmount -t vfat :: partition vfat mount mount /dev/cdrom :: CD ROM #cd/mnt/cdrom #lsumount /dev/cdrom :: CD ROM #cd / eject :: umount eject CD-ROM umount #mount server /dev/hda5 on / typeext3 (rw) none on /proc type proc (rw) /dev/hda1 on /boot typeext3 (rw) none on /dev/pts type devpts (rw,gid=5,mode=620)/dev/hda3 on /home type ext3 (rw) none on /dev/shm typetmpfs (rw) /dev/hda2 on /usr type ext3 (rw) /dev/hda6 on /vartype ext3 (rw)--------------------------------------------------------------------------------2.20 mkbootdisk : boot disk boot linux stand alone-------------------------------------------------------------------------------- harddisk linux 2 boot boot harddisk #lilo boot /etc/lilo.conf 2.4.18-14 kernel Redhat 8.0 boot mkbootdisk --device /dev/fd0 2.4.18-14 :: disk boot linux boot --------------------------------------------------------------------------------2.21 traceroute : ip -------------------------------------------------------------------------------- www.thai.net 8 router router ip router /usr/sbin/traceroute www.thai.nettraceroute to www.thai.net (203.150.13.2), 30 hops max, 38byte packets1 door.yonok.ac.th (202.29.78.254) 2.046 ms 1.962 ms 2.532 ms2 202.28.29.41 (202.28.29.41) 3.703 ms 3.294 ms 3.760 ms3 UniNet-BKK2-ATM1-0-0.700.uni.net.th (202.28.28.129) 14.185 ms 13.226 ms 14.614 ms

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    24 of 29 4/8/2014 12:12 AM

  • 4 202.28.28.18 (202.28.28.18) 13.705 ms 13.227 ms 14.130ms5 202.47.255.2 (202.47.255.2) 13.222 ms 13.890 ms 13.210ms6 202.129.63.182 (202.129.63.182) 16.649 ms 14.960 ms 15.659 ms7 juliet-vlan-2.bkk.inet-th.net (203.150.14.22) 14.817 ms 15.573 ms 15.610 ms8 www.thai.net (203.150.13.2) 15.628 ms 14.775 ms 14.222ms

    --------------------------------------------------------------------------------2.22 rpm : package linux -------------------------------------------------------------------------------- rpm package install package version package Redhat 7.2 pop3 mount /dev/cdrom installpackage pop telnet localhost 110 error package pop rpm -iimap-4.7-5.i386.rpm cd /mnt/cdrom/RedHat/RPMS install rpm -i imap-4.7-5.i386.rpm :: install package pop linux 8.99 CD-ROMrpm -qa|grep imap :: package imaprpm -qa :: package install rpm -q telnet :: package telnet rpm -qpl imap-4.7-5.i386.rpm :: package /mnt/cdrom/RedHat/RPMS rpm -qf /usr/sbin/vi :: vim-minimal-5.6-11 vi rpm -qf /usr/sbin/httpd :: apache-1.3.12-2 linux 6.2rpm -e apache-1.3.12-2 :: erase apache-1.3.12-2 rpm -Fvh openssl-0.9.5a-2.6.x.i386.rpm :: Upgrade rpm -qi vsftpd :: Application --------------------------------------------------------------------------------2.23 SU : Super user root

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    25 of 29 4/8/2014 12:12 AM

  • -------------------------------------------------------------------------------- su su user root root root super user ( su su) su su - $PATH #su - :: super user #su prasert :: login user user prasert logout login --------------------------------------------------------------------------------2.24 useradd : -------------------------------------------------------------------------------- #useradd theman :: theman theman home directory /home/theman#useradd -g users -d /home/theman -c "user name here"theman :: theman--------------------------------------------------------------------------------2.25 userdel : -------------------------------------------------------------------------------- #userdel -r theman :: theman home directory theman --------------------------------------------------------------------------------2.26 usermod : -------------------------------------------------------------------------------- #usermod -s /rbin/menu theman :: shell user theman shell#usermod -d /home/theman theman :: theman homedirectory /home/theman#usermod -c "Mr.Suwit Somsupabrungyod" theman :: comment Mr.Suwit Somsupabrungyod comment pine theman to compose comment email --------------------------------------------------------------------------------2.27 crontab : --------------------------------------------------------------------------------

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    26 of 29 4/8/2014 12:12 AM

  • #crontab -l :: #cat /etc/crontab :: crontab --------------------------------------------------------------------------------2.28 lspci : -------------------------------------------------------------------------------- #lspci00:00.0 Host bridge: Intel Corp . 440BX/ZX/DX -82443BX/ZX/DX Host bridge (rev 03)00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DXAGP bridge (rev 03)00:07.0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev02)00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE(rev 01)00:07.2 USB Controller : Intel Corp. 82371AB/EB/MB PIIX4 USB(rev 01)00:07.3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev02)00:0f.0 PCI bridge: Digital Equipment Corporation DECchip21152 (rev 03)00:11.0 Ethernet controller: 3Com Corporation 3c905B100BaseTX [Cyclone] (rev 24)01:00.0 VGA compatible controller: ATI Technologies Inc 3DRage Pro AGP 1X/2X (rev 5c)

    --------------------------------------------------------------------------------2.29 nmap : class C-------------------------------------------------------------------------------- #nmap -sP 202.29.78.*Starting nmap V. 3.00 ( www.insecure.org/nmap/ )Host (202.29.78.0) seems to be a subnet broadcast address(returned 1 extra pings).Note -- the actual IP also responded.Host www.isinthai.com (202.29.78.1) appears to be up.Host course.yonok.ac.th (202.29.78.5) appears to be up.Host yonok.ac.th (202.29.78.12) appears to be up.Host w2kdhcp.yonok.ac.th (202.29.78.17) appears to be up.Host (202.29.78.31) appears to be up.Host (202.29.78.32) appears to be up.Host (202.29.78.33) appears to be up.

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    27 of 29 4/8/2014 12:12 AM

  • #nmap -sT www.yonok.ac.th (on TCP)Starting nmap V. 3.00 ( www.insecure.org/nmap/ )Interesting ports on yonok.ac.th (202.29.78.12):(The 1590 ports scanned but not shown below are in state:closed)Port State Service21/tcp open ftp22/tcp open ssh25/tcp open smtp53/tcp open domain80/tcp open http109/tcp open pop-2110/tcp open pop-3#nmap www.yonok.ac.th -sU (on UDP)Starting nmap V. 3.00 ( www.insecure.org/nmap/ )Interesting ports on yn1.yonok.ac.th (202.29.78.12):(The 1465 ports scanned but not shown below are in state:closed)Port State Service53/udp open domain111/udp open sunrpc867/udp open unknowsource: http://www.ensthai.com/tip_trick/page/unix_command_p2.php : 17, 2012,10:11:10 AM onearth99

    Work Hard, Play Hard, Travel Hard

    GiftrinAdministrator

    Like: 678

    : 6408

    Re: Command Unix () #2 : 17, 2012, 01:28:23 PM

    ^^

    - Connection is "King" -

    > Asset

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    28 of 29 4/8/2014 12:12 AM

  • > ,

    koomaksornMK-WPQuick+MK-IMMate

    Like: 1

    : 89

    Re: Command Unix () #3 : 20, 2012, 12:31:50 PM

    +1

    bank_i3MK-WPQuick

    Like: 1

    : 20

    Re: Command Unix () #4 : 20, 2012, 01:39:48 PM

    : [1]

    :

    Powered by SMF 1.1.12 | SMF 2006-2009, Simple Machines LLC

    Command Unix () http://www.mk4im.com/index.php?topic=1825.0

    29 of 29 4/8/2014 12:12 AM