Change Directory (cd) shortcuts

Change Directory (cd) shortcuts

これには簡単な答えがあるはずですが、「cd」を検索しようとすると、すべての検索結果は Linux コマンドではなくコンパクト ディスクに関連しています。

cd ..

現在いるディレクトリの親ディレクトリに移動します。ただし、私の職場のPCでは、

..

すべて単独で同じことを実行します。職場のクラスターの 1 つでもこれを行うことができますが、他のクラスターでは実行できません。このショートカットを使用して、他の場所で複製できるようにするには、どうすればよいですか?

答え1

If your shell is bash and it supports the autocd option, you can enable it by

shopt -s autocd

You can then use not only .., but also bin, ./data, /var/log, or any path. (It only works in an interactive shell, i.e. not in a script.)

Another option is to define an alias:

alias ..='cd ..'

I also like

alias ...='cd ../..'

関連情報