cd : 切換目前的工作目錄
當我們想要切換到其它的目錄時, cd 這一個命令便提供了這項功能:
[cherry:/home1/student/stud82/s8227] pwd
/home1/student/stud82/s8227
[cherry:/home1/student/stud82/s8227] ls -F
Html/ gif/ net/
Mail/ html/ sparc-sun-solaris2.4/
X11/ java/ xcin_dir/
bin/ lib/
doc/ music/
[cherry:/home1/student/stud82/s8227] cd bin
[cherry:/home1/student/stud82/s8227/bin] pwd
/home1/student/stud82/s8227/bin
[cherry:/home1/student/stud82/s8227/bin] ls
ansi2knr install.sh sparc-sun-solaris2.4-gcc
c++ lock src
g++ m2d unprotoize
gcc make uuencode
gtar protoize ztar
[cherry:/home1/student/stud82/s8227/bin]
上面的例子裡, 我們先用 pwd 這個指令查看目前的工作目錄,
然後用 ls 列出這個目錄下的檔案及其屬性, 一些檔案名稱後接著
"/" 字元表是那是個目錄, 於是我們便可以用 cd 切換到這些目錄裡去.