UNIX Quick Guide Chien Chin Chen Department of

  • Slides: 30
Download presentation
UNIX Quick Guide Chien Chin Chen Department of Information Management National Taiwan University Reference:

UNIX Quick Guide Chien Chin Chen Department of Information Management National Taiwan University Reference: “A Quick Guide for UNIX Newbies”, by 楊景翔, 研院

 欲善其事…必先利其器… n 系上的 作站: n n IP 位址為 140. 112. 106. 6 ~

欲善其事…必先利其器… n 系上的 作站: n n IP 位址為 140. 112. 106. 6 ~ 140. 112. 106. 15。 請用ssh (security shell) 登入。 n http: //ntu. csie. org/~piaip/pietty/ 2

Outline n Login & Logout. n 常用指令. n UNIX的文字編輯器– vi n UNIX的線上手冊 – man

Outline n Login & Logout. n 常用指令. n UNIX的文字編輯器– vi n UNIX的線上手冊 – man 3

常用指令 (3/13) n cd – 切換目錄(change directory)。 @ ~ … @ code @ OS_exercises

常用指令 (3/13) n cd – 切換目錄(change directory)。 @ ~ … @ code @ OS_exercises @ ch 03 ch 04 10

常用指令 (4/13) n cp – 複製檔案(copy)。 ~ … code OS_exercises @ ch 03 exercise

常用指令 (4/13) n cp – 複製檔案(copy)。 ~ … code OS_exercises @ ch 03 exercise 1. cpp ch 04 exercise 1. cpp 11

常用指令 (5/13) n rm – 移除檔案(remove)。 ~ … code OS_exercises @ ch 03 exercise

常用指令 (5/13) n rm – 移除檔案(remove)。 ~ … code OS_exercises @ ch 03 exercise 1. cpp ch 04 exercise 1. cpp 12

常用指令 (6/13) n rmdir – 刪除目錄(remove directory)。 @ ~ … code @ OS_exercises ch

常用指令 (6/13) n rmdir – 刪除目錄(remove directory)。 @ ~ … code @ OS_exercises ch 03 ch 04 exercise 1. cpp 13

常用指令 (7/13) n mv – 搬移檔案(move)。 ~ … code @ OS_exercises @ ch 03

常用指令 (7/13) n mv – 搬移檔案(move)。 ~ … code @ OS_exercises @ ch 03 exercise 1. cpp~ exercise 1. cpp 14

常用指令 (10/13) n ps – process status。 n n 你可以看自己或整個系統(運用 -A 選項 -u 秀出user

常用指令 (10/13) n ps – process status。 n n 你可以看自己或整個系統(運用 -A 選項 -u 秀出user name。 CPU utilization 選項)的process state status。 在做什麼事情 17

常用指令 (12/13) n chmod – 改變檔案的權限(change mode)。 n 權限: <read, write, execute> n owner

常用指令 (12/13) n chmod – 改變檔案的權限(change mode)。 n 權限: <read, write, execute> n owner can read and write rw-r--r--: 110 100 644. group can read others can read 19

常用指令 (13/13) n gcc or g++ – C與C++的compiler。 n 語法: gcc (or g++) –o

常用指令 (13/13) n gcc or g++ – C與C++的compiler。 n 語法: gcc (or g++) –o 執行檔名 xxxx. c (or xxxx. cpp) 20

UNIX的線上手冊 – man (1/3) n Typical syntax: man [section] command_or_function n Section: 1. 2.

UNIX的線上手冊 – man (1/3) n Typical syntax: man [section] command_or_function n Section: 1. 2. 3. 4. 5. 6. 7. 8. 9. User commands. System calls and error numbers. Functions in the C libraries. Device drivers. File formats. Games and other diversions. Miscellaneous information. System maintenance and operation commands. Kernel interface documentation. 27

UNIX的線上手冊 – man (2/3) n Example: man 2 fork The headers that you should

UNIX的線上手冊 – man (2/3) n Example: man 2 fork The headers that you should include Explanations of arguments and return value. 28

UNIX的線上手冊 – man (3/3) n man exit n The usage of command exit. n

UNIX的線上手冊 – man (3/3) n man exit n The usage of command exit. n man 2 exit n The usage of system call exit(). No sexual discrimination … but man is very important ^_^ 29

Others n 了解與個人化你的shell。 n 如何設定初始環境 – 環境變數如PATH … 。 n 自訂初始設定檔 -. cshrc 如設定一些個人喜好的alias。

Others n 了解與個人化你的shell。 n 如何設定初始環境 – 環境變數如PATH … 。 n 自訂初始設定檔 -. cshrc 如設定一些個人喜好的alias。 n alias l=‘ls –l’ n Shell script。 n 寫程式來安排一些規律性的 作。 n 如何自己安裝Linux (make kernel),你的腳色會由user變成 administrator。 n How to satisfy your users? n n n Setup general environment. Install software … 30