创建所需目录的别名以在终端中使用

Geo*_*Geo 7 shortcuts alias directory

我经常需要输入:

cd /home/geo/Geant4/geant4.10.00.p02-install/lib/Geant4-10.0.2
Run Code Online (Sandbox Code Playgroud)

如何为该目录创建别名,以便我可以输入:

cd $geant (or any other word I decide to create as the alias name)
Run Code Online (Sandbox Code Playgroud)

它也会在我需要使用时帮助我,cmake因为我也可以$geantcmake选项中间使用。

谢谢。

TuK*_*Ksn 8

打开您的$HOME/.bashrc并附加:

export GEANT=/home/geo/Geant4/geant4.10.00.p02-install/lib/Geant4-10.0.2
Run Code Online (Sandbox Code Playgroud)

然后运行source ~/.bashrc ,现在你应该可以像这样使用它:

cd $GEANT
Run Code Online (Sandbox Code Playgroud)