LoginSignup
0
1

More than 3 years have passed since last update.

Bashのcdコマンドで移動前のディレクトリに戻る方法

Last updated at Posted at 2020-12-30

便利なcdコマンドの使い方を知ったのでメモ

cd -で1つ前にいた移動前のディレクトリに戻ることができる。

$ pwd
/home/someuser
$ cd somewhere/to/work && pwd
/home/someuser/somewhere/to/work
$ cd -
/home/someuser
$ cd -
/home/someuser/somewhere/to/work

npm scriptsやCI/CDでディレクトリを移動して作業した後、元いたプロジェクトのルートディレクトリに戻る時に便利

$ cd path/to/child && [何か作業する] && cd -
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1