Sunday, June 21, 2009
Ok you have a folder on the desktop of your linux machine and you are trying to improve your terminal skills. Now you are normally in your home folder per your enviroment variables when terminal (BASH) opens.

For example:

[tech-slave@slave ~]$

Now lets say the folder you want to access is on the Desktop and called "n00b1." Now typing out:

$ cd /home/tech-slave/Desktop/noob1

may be a little long and tedious for some. Now there is the 1,000 command log of your BASH history file and other options but we aren't talking about those options today. Today we are talking about setting variables so to set it temporarily you can type:

$ NB=/home/tech-slave/Desktop/noob1 ; export NB

Now we have taken what can be a long directory path and assigned it to the NB variable. When we export to the NB command this propigates the value to the current BASH terminal session which then can be sent forward to any other shells you open while this one is running. Now you can reach the directory by typing:

$ cd $NB

Much less to type but this is the temporary value so when you exit the BASH terminal session the setting is lost. To make it permanent edit the ~/.bashrc file so it become permanent. Now if you only use this periodically you might want to think about making and executable text file and just launch the file when you need the variable.

Ahh GNU/Linux - choices, choices, choices :-)

Later,
arizona.rune@gmail.com

0 comments:

Pages

About Me

AZ-RUNE. Powered by Blogger.

Followers