cdコマンド.
必ず使うコマンドだけど,意外と知らないこともあった.
オプション
オプション | 内容 |
---|---|
-L | 指定ディレクトリがシンボリックリンクの場合,シンボリックリンクのターゲットへ移動 |
-P | 指定ディレクトリがシンボリックリンクの場合,シンボリックリンクへ移動 |
例
$ tree test/ test/ └── nested_test └── nested_test2 test2(nested_test2へのシンボリックリンク) $ cd test2 $ pwd /home/twinbird/test2/ $ cd -L test2 $ pwd /home/twinbird/test2/ $ cd -P test2 $ pwd /home/twinbird/test/nested_test/nested_test2
特殊な指定
ディレクトリ名 | 内容 |
---|---|
- | 現在のディレクトリを表示します(pwdと同じ) |
指定なし | ユーザのホームディレクトリへ移動 |
例
$cd - /home/twinbird/ $pwd /home/twinbird/
pwdの代わりに使えるなんて知らなかったので案外調べてみるもんだなぁと思った.