# Terminal Command line 指令 in MacOS Mac OS terminal command line. --- # 路徑指令 ``` cd [目標地址] ``` * 前往目錄地址(絕對地址) change diretory ``` cd .. ``` * 前往上一層(相對地址) ``` cd / ``` * 回到根目錄 ``` cd ~ ``` * 回到home ``` ls ``` * 列出當前目錄底下的所有檔案 ``` ls -al ``` * 當前目錄底下的所有檔案及詳細資訊 ``` pwd ``` * 印出當前位置 # 資料夾指令 ``` mkdir [新增的資料夾名稱] ``` * 新增目錄 make diretory ``` mkdir [要移除的資料夾名稱] ``` * 刪除目錄 remove diretory * 只能刪除空白目錄 * 刪除後就找不到了 ``` mv [原檔案位置/檔名] [新檔案位置/檔名] ``` * 移動檔案 move * 可當改名使用 [原檔名] [新檔名] # 檔案指令 ``` touch [檔案名稱] ``` * 更改檔案時間戳記 * 若呼叫的檔案不存在則新建一個檔案 ``` rm [檔案名稱] ``` * 刪除檔案 ``` rm -i [diretory]/* ``` * 刪除目錄底下所有檔案 * 輸入指令後按y刪除,按enter取消刪除 ``` rm -r [目錄名稱] ``` * 刪除目錄及底下所有檔案 * 請謹慎使用 ``` cp [原檔案位置] [新檔案位置] ``` * 複製檔案 * 相同位置則會建立副本 # 執行指令 ``` sudo ``` * 使用root權限執行 super user do ``` man [指令] ``` * 查詢指令說明書 manual * 按q跳出 quit # 其他指令 ``` date ``` * 顯示當前時間 ``` clear ``` * 清空terminal版面 # 參考資料 * [IBM官方 Linux指令](https://www.ibm.com/docs/zh-tw/aix/7.1?topic=commands) * [Apple 官方說明文件](https://developer.apple.com/library/archive/documentation/OpenSource/Conceptual/ShellScripting/CommandLInePrimer/CommandLine.html)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up