Create an alias to a desired directory to use within the Terminal
10,426
Solution 1
Open your $HOME/.bashrc
and append:
export GEANT=/home/geo/Geant4/geant4.10.00.p02-install/lib/Geant4-10.0.2
then run source ~/.bashrc
and now you schould be able to use it like this:
cd $GEANT
Solution 2
Just create a link in nautilus, and treat it as a normal folder. Terminal will go straight to it.
Related videos on Youtube
Author by
Geo
Updated on September 18, 2022Comments
-
Geo over 1 year
I constantly need to type:
cd /home/geo/Geant4/geant4.10.00.p02-install/lib/Geant4-10.0.2
How do I create an alias to that directory, so I could just type:
cd $geant (or any other word I decide to create as the alias name)
It would also help me whenever I need to use
cmake
because I could use$geant
as well in the middle of acmake
option.Thanks.
-
Geo almost 10 yearsuhh sorry. I'm new to ubuntu and those stuff and I didnt know that it was basically the same question
-
mniess almost 10 yearsNo problem! askubuntu does this automatically when I mark a question as duplicate to let you know where you find your answer. That's the beauty of it.
-
-
Geo almost 10 yearsactually I dont mind the "cd" part. i care more about the cmake. i always need to do cmake -dGeant4_DIR=/home/geo/Geant4/geant4.10.00.p02-install/lib/Geant4-10.0.2 and thats a long command which i need to keep looking the full directory everytime i run the program. I'd rather type cmake -DGeant_DIR=$geant.
-
Tim almost 10 yearsI think that will work.
-
Geo almost 10 yearstried it using cmake. it gave errors when configuring =\
-
Geo almost 10 yearsthank you sir. i have been trying with the alias command, but seems they are only to command
-
Tim almost 10 years@Geo Can you show the errors to us?
-
Geo almost 10 yearssure. After installing Geant4, tried to run an example (B3) with the /home/geo/geant being a link to that big directory i need to use heres the output: imageshack.com/a/img855/4199/dd5n.png
-
Tim almost 10 yearsTuknutx has the right idea, use that. Sorry mine was wrong...
-
Geo almost 10 yearsits cool =) your mode works with a "cd" command, but some programs (or at least geant4) had a problem reading that as a link
-
Tim almost 10 yearsYeah :) An I learnt that I could use them in terminal! :P