红穆笔记

cd

更改當前工作目錄

100% 瀏覽器本地處理 0 數據上傳

常用示例

轉到指定目錄

cd {{路徑/到/目錄}}

轉到當前目錄的父目錄

cd ..

轉到當前用戶的主(home)目錄

cd

轉到指定用戶的主(home)目錄

cd ~{{用戶名}}

轉到剛纔選擇的目錄

cd -

轉到根目錄

cd /

提示:花括號{{…}}是需要替換的參數(路徑、文件名等);命令只在本機終端執行,本站不保存任何輸入。

英文原文對照

展開英文說明與示例(來源 tldr-pages)

Change the current working directory. More information

Go to the specified directory

cd {{path/to/directory}}

Go up to the parent of the current directory

cd ..

Go to the home directory of the current user

cd

Go to the home directory of the specified user

cd ~{{username}}

Go to the previously chosen directory

cd -

Go to the root directory

cd /

命令信息

命令名cd
用途更改當前工作目錄
適用平臺通用,MS-DOS,Windows
示例數量6 條
官方文檔https://www.gnu.org/software/bash/manual/bash.html#index-cd
數據來源tldr-pages(CC-BY-4.0)· 社區中文翻譯

常見問題

cd 命令是做什麼的?

更改當前工作目錄

cd 怎麼用?

頁面按場景列出了6 條常用示例:每條示例先說明用途,再給出可直接複製的完整命令(花括號裏是需要替換的參數)。

cd 最常用的操作是什麼?

轉到指定目錄:cd {{路徑/到/目錄}}

命令裏的花括號是什麼意思?

花括號{{…}}表示需要替換成你自己的值,例如路徑、文件名;同名參數方括號(如 [-C|--directory])表示可選寫法。