Getting Start
• For students does not have a login account or forgot your password, please check 217 TA
during office hours.
• We have 20 linux machines, and the host name is “linux1.csie.ntu.edu.tw”, 1 can be replaced with 2~20.
• Note that linux15 is reserved for daily use.
DO NOT RUN COMPUTING-INTENSIVE JOBS!
How to Login
• Pietty/Putty http://ntu.csie.org/~piaip/pietty/
How to Transmit Files
• FileZilla
– Port 22
• wget
– only for download
Linux Tips
• Tab is your good friend
• cd brings you home
• ./ means current directory
• ../ means parent directory
• / means root directory
• *
• http://mrtg.csie.ntu.edu.tw/status.html
• Network File System v.s Local File System
Basic Commands
• man Online manual
• cd Change directory
• pwd Present working directory
• ls List directory contents
• cp SOURCE DEST Copy files to directory
• mkdir
• mv SOURCE DEST Move or rename
• rm Remove(沒有資源回收桶,請小心)
• rmdir
• cat, more, head, tail Reading Files
• du Estimate file space usage
• passwd Change password
Running Jobs
• Process management:
– ps 顯示process 狀態
– top 類似 ps 但提供動態的資訊更新 – kill 刪掉正在執行的 process
– Ctrl + c 中斷目前的命令 – 背景執行 : ctrl + z , bg , &
• 按下 Ctrl + z 會暫停目前的命令
• bg [jobspec] 會將暫停的命令放到背景執行
• 輸入命令時在最後端補 & 符號,會直接在背景執行
• fg 把背景執行的命令拉回前景
Vi / Vim
• Vi 是 linux 下常用的編輯器
– 剛開檔時是指令模式
• 在任何模式下按 esc 可回到指令模式
• 按 v 可選取範圍,選完後按 y 是複製,c 是剪下,p 是貼上
• u 是復原
• 按:可輸入命令
– :q 不存檔離開
– :q! 強制不存檔離開 – :wq 存檔離開
– :w 存檔
– 按 i 進入插字模式
– 如果按到 ctrl-s ,按 ctrl-q 它就死而復生
Compile and Makefile
• gcc / g++
– Default output a.out, change by option “–o”
• Makefile/makefile
– make
– make run – make clean
檔案權限
• User, Group, Others
• Read(r), Write(w), Execution(x)
• Encoded as bit string.
– rwx-rwx-rwx(777) – rwx--wx---- (750) – rwx--- (700)
• Protect your homework form plagiarism is your responsibility
• chmod 700 filename
Learn More by Yourself
• http://linux.vbird.org/linux_basic/
• http://www.gnu.org/software/make/manual/
make.html
• http://www.cplusplus.com/reference/