Upload
xsoameix
View
128
Download
1
Embed Size (px)
Citation preview
Learn linux commandLearn linux command
學習常用的 linux 指令學習常用的 linux 指令
Command LineCommand Line
● 控制電腦的文字介面● 可以輸入指令
1. 按鍵盤觸發中斷
2. CPU 處理中斷,把字碼放進緩衝區
3. Terminal 讀取緩衝區,印在螢幕上
4. 如果按下的是 enter ,就執行該指令● 使用方式:
$ type something ... 然後按 enter
● 控制電腦的文字介面● 可以輸入指令
1. 按鍵盤觸發中斷
2. CPU 處理中斷,把字碼放進緩衝區
3. Terminal 讀取緩衝區,印在螢幕上
4. 如果按下的是 enter ,就執行該指令● 使用方式:
$ type something ... 然後按 enter
Command LineCommand Line
● 請先登入● 左上角找一下 Terminal ,點開
ls
● 查看目錄下有哪些檔案● 全名為: list segments
現在的 files 以前叫作 segments
ls
● 使用方式:$ ls
cd
● 切換目錄● 全名為: change directories
cd
● 下一層目錄:$ cd directory_name
● 上一層目錄:$ cd ..
● 家目錄:$ cd
● 特定目錄:$ cd /etc
mkdir
● 建立目錄● 全名為: make directory
● 使用方式:$ mkdir new_directory_name
cp
● 複製檔案● 全名為: copy
● 使用方式:$ cp directory_or_file new_directory_or_file
vi
● 新增、編輯、儲存檔案● 學習門檻高,礙於時間暫不介紹
gedit
● 新增、編輯、儲存檔案● 視窗化介面● 使用方式:
$ gedit file_name
mv
● 移動、重新命名檔案● 全名為: move
● 使用方式:$ mv directory_or_file new_directory_or_file
rm
● 刪除檔案● 全名為: remove
● 使用方式:$ rm file
$ rm -r directory
Hello world !Hello world !
● 在家目錄下建立一個目錄叫 hello
● 切進去 hello
● 新增並編輯 hello.c
● 編譯 hello.c
$ gcc hello.c -o hello● 執行 hello
$ ./hello● 刪除 hello 目錄
● 在家目錄下建立一個目錄叫 hello
● 切進去 hello
● 新增並編輯 hello.c
● 編譯 hello.c
$ gcc hello.c -o hello● 執行 hello
$ ./hello● 刪除 hello 目錄