Section Next | Prev


2.4.9 ディレクトリの移動(cd)

【機能説明】
コマンド cd は、ワーキング・ディレクトリを指定したディレクトリに変えます。 ディレクトリ名を省略した場合は、ホーム・ディレクトリ(ログイン時のディレクトリ )になります。
環境変数 CDPATH が設定されている場合は、その中に定義されたディレクトレリか ら相対的に指定されるディレクトリへ移動します。

【入力フォーマット】
cd [ディレクトリ]

【実行例】
ログイン直後のカレントディレクトリを確認(ホームディレクトリ)
	[student@h006 ~]$ pwd
	/home/student
カレント・ディレクトリをサブ・ディレクトリ public_html/Startup へ移動。
	[student@h006 ~]$ cd public_html/Startup/
	[student@h006 Startup]$ ls
	Admin    Programmers  Tips   index.html        remarks.html  work
	Network  Solaris      Users  index.html.eucjp  rpm.log
さらにサブディレクトリ Users へ移動
	[student@h006 Startup]$ cd Users/
	[student@h006 Users]$ pwd
	/home/student/public_html/Startup/Users
ひとつ上のディレクトリ(../)という表現を使って、となりの Programmers へ
	[student@h006 Users]$ cd ../Programmers/
ホームディレクトリへ戻り
	[student@h006 Programmers]$ cd
	[student@h006 ~]$ pwd
	/home/student
CDPATH で指定されたサブディレクトリへ直接移動
	[student@h006 ~]$ CDPATH=~/public_html
	[student@h006 ~]$ cd Startup
	/home/student/public_html/Startup
	なおCDPATHの内容に従って移動した場合は、cd 実行直後にディレクトリが表示される。

Section Next | Prev

Copyright 2007-2018 ycosSystems GettingStart/Body249.html