UNIX 指令使用示範
  * ls      列出所在目錄之檔案

  例 jason% ls
     Batchftp		  bother.com	       info.txt
     DL 		  dir.txt	       mwei


  * ls -l    列出非隱藏之所有檔案

  例 jason% ls -l
     total 2034
     drwx------  2 s9411166	 512 Sep  4 14:11 Batchftp
     drwx------  2 s9411166	 512 Aug 22 15:31 DL
     drwx------  2 s9411166	 512 Sep 12 12:48 DOS
     -rwx------  1 s9411166    25397 Jun 19 13:48 MODs


  * ls -a    列出所有檔案(包括隱藏)

  例 jason% ls -a
     .			  .record	       bother.com
     .. 		  .rnlast	       dir.txt
     .Xauthority	  .rnsoft	       dir1.txt
     .ftptoolrc 	  Batchftp	       mwei
     .joerc		  DL		       r1


  * ls -F    看出各種不同檔案( / 為目錄 , * 為可執行檔 )

  例 jason% ls -F
     Batchftp/		   bother.com*		 info.txt*
     DL/		   dir.txt*		 mwei*
     L DOS/		     dir1.txt*		   r1*
     MODs*		   emacs*		 report*


  * ls -C    強迫以好幾列方式顯示檔案

  例 jason% ls -CF
     Batchftp/		   bother.com*		 info.txt*
     DL/		   dir.txt*		 mwei*
     DOS/		   dir1.txt*		 r1*
     MODs*		   emacs*		 report*


  * stty     設定終端機鍵盤功能按鍵

  例 jason% stty -a
     speed 38400 baud, 0 rows, 0 columns
     eucw 1:2:3:2, scrw 1:2:2:2
     parenb -parodd cs7 -cstopb -hupcl cread -clocal -crtscts
     -ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
     ixon -ixany -ixoff imaxbel
     isig iexten icanon -xcase echo echoe echok -echonl -noflsh -tostop
     echoctl -echoprt echoke
     opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tabs
     erase  kill   werase rprnt  flush	lnext  susp   intr   quit   stop   eof
     ^?     ^U	   ^W	  ^R	 ^O	^V     ^Z/^Y  ^C     ^\     ^S/^Q  ^D

     jason% stty erase ^H


  * history     列出你曾鍵入之命令

  例 jason% history
	  1  ls
	  2  ls -l
	  3  ls -a
	  4  ls -F
	  5  ls -aF


  *  !         呼叫你所用過之指令

  例 jason% !13
     ls
     Batchftp		  bother.com	       info.txt
     DL 		  dir.txt	       mwei
     DOS		  dir1.txt	       r1


  * cat     	顯示檔案之內容

  例 jason% cat info.txt
     NTU
       140.112.28.163
     ARCHIE
       147.225.1.2
       128.167.254.179


  * alias         別名器

  例 jason% alias
     cd      cd !*;echo $cwd
     cls     clear
     cp      cp -i
     help    man
     mv      mv -i
     pwd     echo $cwd


  * pwd       顯示你目前之工作目錄

  例 jason% pwd
     /home/user/s9411166


  * ps		 顯示你目前所執行之 process 代號

  例 jason% ps
     28959 p2 S     0:00 -csh (csh)
     28984 p2 TW    0:00 ftptool
     28986 p2 R     0:00 ps


  *  jobs        顯示你目前之工作代號

  例 jason% jobs
     [1]  + Stopped		 ftptool


  *  kill      除去一個 process

  例  jason% kill 4679
      [1]    Terminated 	  ftptool


  *  ps aux    顯示出所有人之 process代號

  例 jason% ps aux
     USER	PID %CPU %MEM	SZ  RSS TT STAT START  TIME COMMAND
     root	  0  0.0  0.0	 0    0 ?  D	Sep 10	2:24 swapper
     root     28001  0.0  0.0	44    0 ?  IW	09:18	0:00 in.telnetd
     mctsai   28002  0.0  0.0	92    0 p1 IW	09:18	0:00 -csh (csh)
     s9411166 28988  0.0  0.4  216  456 p2 R	12:54	0:00 ps aux
     fangjj   28873  0.0  0.0 1  92    0 p0 IW	 12:12	 0:00 mail
     mctsai   28006  0.0  0.0	76    0 p1 IW	09:18	0:00 mail
     root     28868  0.0  0.0	44    0 ?  IW	12:12	0:02 in.telnetd


  * cal     	 印出本月之月曆

  例  jason% cal
	September 1992
      S  M Tu  W Th  F	S
	    1  2  3  4	5
      6  7  8  9 10 11 12
     13 14 15 16 17 18 19
     20 21 22 23 24 25 26
     27 28 29 30


  * cal 〔month〕〔year〕 印出某年某月之月曆

  例  jason% cal 10 90
	October 90
      S  M Tu  W Th  F	S
		     1	2
      3  4  5  6  7  8	9
     10 11 12 13 14 15 16
     17 18 19 20 21 22 23
     24 25 26 27 28 29 30
     31


  *  rm       刪除檔案

  例 jason% rm dir1.txt


  *  finger      顯示你目前線上使用者之狀況

  例 jason% finger
     Login	 Name		   TTY Idle    When    Where
     mctsai	     ???	    p1 3:52 Fri 09:18  140.116.175.55
     s9411166 Ming -Sheng Wei	    p2	  1 Fri 12:47  140.116.2.211


  *  chfn      改變使用者之 full name

  例 jason% chfn
     Changing finger information for s9411166 on mail.
     Default values are printed inside of '[]'.
     To accept the default, type .
     To have a blank entry, type the word 'none'.

     Name [Ming -Sheng Wei]: jason

     jason% finger
     Login	 Name		   TTY Idle    When    Where
     mctsai	     ???	    p1 3:54 Fri 09:18  140.116.175.55
     s9411166 jason		    p2	    Fri 12:47  140.116.2.211
     jgl      Jyh.Gung.LIN	    p3	    Fri 11:43  140.116.72.186

     jason% finger jgl
     Login name: jgl			     In real life: Jyh.Gung.LIN
     Directory: /home/user/jgl		     Shell: /bin/csh
     On since Sep 19 16:35:54 on ttyp3 from 140.116.72.186
     28 seconds Idle Time
     Mail last read Sat Sep 19 16:10:06 1992
     No Plan.


  *  who        顯示目前線上使用者

  例 jason% who
     s8361180 ttyp0   Sep 18 13:12   (140.116.2.136)
     mctsai   ttyp1   Sep 18 09:18   (140.116.175.55)
     s9411166 ttyp2   Sep 18 12:47   (140.116.2.211)
     jgl      ttyp3   Sep 18 13:12   (140.116.32.17)


  *  whoami       我是誰 ?

  例 jason% whoami
     s9411166


  *  chmod      	改變檔案屬性

	- -wx r-x --x   351
	d rwx rwx rwx   777
	- rwx  --- ---   700
	- rw- -w- r-x   625
	     4 2 1   4 2 1   4 2 1
	     owner   group   other

  例 jason% chmod 400 report
     -r--------  1 s9411166	1785 Aug 28 13:20 report


  * write      送訊息給其他線上使用者

  例 jason% write saint
     write: saint not logged in

     jason% write s9411166

     Message from s9411166@mail on ttyp2 at 13:16 ...
     Hello,Who who am I ????
     Hello,who am I ????
     bye.


  * msg       設定是否接收訊息 ( y : 要  n : 不要 )

  例 jason% mesg n
     jason% mesg y

     s9405n042 ttyp0   Sep 18 13:24   (140.116.4.91)
     s9411166 ttyp2   Sep 18 12:47   (140.116.2.211)

  * talk	      與線上使用者交談

  例 jason% talk s9405042

      ....................

     Message from Talk_Daemon@mail at 13:30 ...
     talk: connection requested by s9405042@mailk.
     talk: respond with:  talk s9405042@mail


  * man       線上求助系統指令

  例 jason% man ls
     Reformatting page.  Wait... done


  * more 一次以一頁方式顯示輸出或文字檔
  * |      導管命令: 把前者輸出當成後者輸入,再予以輸出 .

  例 jason% ls -l|more
     total 2033
     drwx------  2 s9411166	 512 Sep  4 14:11 Batchftp
	 ...
     -rwx------  1 s9411166	7007 Sep 12 19:25 texinfo-2.15.README
     --More--
     -rwx------  2 s9411166	 512 Aug 25 15:26 tools
	 ...
     -rwx------  1 s9411166    22423 Aug 29 13:15 xdl.c


  *  ︿       更改上次指令

  例 jason% more texinfo-2.15.READDME
     texinfo-2.15.READDME: No such file or direrectory
     jason% ^DME^ME
     jason% more texinfo-2.15.README


  * mkdir       建立目錄

  例 jason% mkdir TEST


 * rmdir       除去一個目錄

  例 jason% rmdir TEST


  *  >   	  輸出轉向指令

  例  jason% ls -l dir1.txt >list.txt
      jason% cat list.txt
      total 2033
      drwx------  2 s9411166	  512 Sep  4 14:11 Batchftp
      drwx------  2 s9411166	  512 Aug 22 15:31 DL
      -rwx------  1 s9411166	 1375 Sep 17 14:20 dir.txt
      drwx------  2 s9411166	  512 Aug 25 15:26 tools


  *  >>   輸出轉向,但與 > 不同是 : 若指定之輸出檔存在,則附加在其後面

  例 jason% ls -F >>list.txt


  * du 	   查詢某一個目錄所佔用之空間大小

  例 jason% du
     1	     ./.elm
     881     ./tools
     1	     ./.wastebasket
     6894    .


  * df    顯示檔案系統中尚有多少空間可用

  例 jason% df
     Filesystem 	   kbytes    used   avail capacity  Mounted on
     /dev/sd0a		    14983    5383    8102    40%    /
     /dev/sd0g		   505437  205690  249204    45%    /usr
     /dev/sd3c		  1255494  451393  678552    40%    /home


  * uname     顯示系統之名稱

  例 jason% uname -a
     SunOS mail 4.1.2-HL 1 sun4m


  *  find     搜尋某個或多個特定之檔案

  例 jason% find / -name '*.gif' -print&
     [1] 3918
     /home/user/rlwu/News/w-dock.gif
     /home/user/rlwu/News/maria_2.gif
     /home/user/lin/gif/xc-fk006.gif


  * cp       拷貝檔案

  例 jason% cp /home/user/lin/gif/*.gif ~/


  * mkdir        建立目錄

  例 jason% mkdir GIF

小恐龍工作坊 提供