LoginSignup
76
73

More than 5 years have passed since last update.

よく使うディレクトリに別名をつける

Posted at

コマンドに別名をつける方法はよく知られていると思いますが、同じようにディレクトリに別名をつけることができます。

文法

次のようにすると、~エイリアス名ディレクトリパス の別名になります。

hash -d エイリアス名=ディレクトリパス

具体例

例えば、次のように設定します。

hash -d log=/var/log

すると、次のように別名を使うことができます。

% ls ~log
(/var/log ディレクトリの内容表示)
% ls ~log/apache2
(/var/log/apache2 ディレクトリの内容表示)
% cd ~log
% pwd
/var/log

ほかにも、cygwin だと以下のような設定をしておくと ~desktop でデスクトップフォルダを扱えるようになります。

hash -d desktop="$(cygpath --desktop)"
76
73
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
76
73