Top 10 : Terminal of command(๑˘ ₃˘๑)

Barry YU
3 min readFeb 13, 2020

--

十大終端機的指令

similar Linux command , Basic enough !

檔案目錄的位置 (Directory list )

$ pwd :

(present working directory )現在什麼位置

$ ls

( list ) 現在底下有什麼檔案

在編輯管理資料庫時, 有時候指令出去是不會告知結果,換句話說要常常透過ls ,確認檔案的狀況.

$ ls -all

list 底下檔案 , (all) 所有副檔名和屬性

$ls |grep ‘ anything you wanna search’

切換目錄位置 ( Directory )

如果有一點點基本Windows system 的MS-DOS commad-line 很易明白.

$ cd

(change directory ) 回到Root 根目錄 , 相當於windows MS-DOS 的 C:\

cd 主要是用來進入不同資料夾的指令。

$ cd \ user \ barry \ test

(change directory )到指定的資料夾 ,

可以在 cd _貼上路徑

$ cd ..

(change directory ).. 回到上一頁

實用小提示:

當資料夾文字冗長,透過開頭的文字再按 “ tab “ , 會自動索引目錄

$ . /users/XXX. => ./

./ 是表示同層的資料及檔案.

資料夾管理 (Folder manager )

新增, 移除, 編輯 , 移動, 複製

$ mkdir

(add folder)新增資料夾

$touch

( add file ) 創建新的檔案

同時建立三個檔案$touch text1.txt app.js html.css

$cp

(copy) 複製檔案 , 但要複製到那?
$cp app.js /barry/test/ 就會複製指定位置.

請不要問我, 為什麼 按照步驟輸入/barry/test/ 會出現no such file or directory …. 我建議你不要當工程師.

$ mv

(move) 移動檔案

Move file path , and modify File name .

移動檔案位置, 以及改檔名

$rm

(remove) 移除檔案

$ls |grep ‘XXXXX’

g = (globally search for )全域搜尋
re=(regular expression)篩選出想要尋找的資料,並且顯示出來
p =(print it) 列出它

常常會搭配不同指令使用, 有* , ls , 很多 . 建議多爬文並且練習

e.g : 
$ ls |grep 'mongo' =>
Show list file , incould ' mongo ' of word of file . for example : mongoDB.tag , Yesmongohaha , Barry.mogo..

$cat

(concatenate) 指令,可以用來預覽檔案的內容。

結語

如果是初學者, 那麼Key in 資料時 , 有Error , 會很詳細告訴您原因.

常見的就是:no such file or directory , command not fund

基本的因為建議編碼工程師是要學習的.

為什麼我在編撰部落格時或在Written會中英文搭配. 希望習慣簡單的英文.

甚至未來在排錯BUG時,能透過關鍵字和外國的工程師互相分享交流.

這是非常重要!!

--

--

No responses yet