Sunday, June 7, 2009
TMOUT = Sets and inactivity timer before BASH will 'auto' logout.

=================================

Now the next to I am going to talk a little more about PATH and WHATEVER. Now in both Windows based PC's and Linux Based PC's Path is the list of directories (or folders for you Windows Users; not admins just users) where commands are executed.

Windows Example:
C:\Documents and Settings\User>path
PATH= C:\WINDOWS\system32;C:\WINDOWS\;C:\WINDOWS\system32\Wbem

This is where Windows (Yes this is XP command prompt) will check to launch programs such as notepad.

Windows Example:
C:\Documents and Settings\User>notepad.exe
\\ POOF // Notepad will open and you are back at the prompt
C:\Documents and Settings\User>

Before my fellow freax's (you will laugh at "freax" if you know what Linus Torvalds wanted to call Linux) get in a huff the Windows stuff is just to showcase what we are talking about today is cross platform. Linux and the various "nix's," i.e.: UNIX and other LINUX distrobutions have terminal/shell prompt which Windows Users will understand as command prompt. Now what we are discussing is how to set "Enviroment Variables" for the Bourne Again SHell (look at the capital letters and now you get BASH).

In GNOME GUI's you can access it via APPLICATIONS > ACCESSORIES > TERMINAL in the Ubuntu distrobution; and via APPLICATIONS > SYSTEM TOOLS > TERMINAL in Fedora. In most KDE GUI's you can find it in the "K" Menu > SYSTEM.

Alright now we have Terminal open and BASH running leaving us at the prompt.
[tech-slave@slave ~]$

Now we will tell it to echo PATH
[tech-slave@slave ~]$ echo $PATH

While I will address the dollar sign briefly. The dollar sign is a metacharacter in BASH and by default most people see it as the last character in the prompt telling them they are working as a standard user where working as 'root' user will show a hash mark or '#' as the last character in the prompt

Ubuntu ex: [tech-slave@slave ~]$ sudo bash
[tech-slave@slave ~]#

Fedora ex: [tech-slave@slave ~]$ su
[tech-slave@slave ~]#

Now the $ sign is also used as the metacharacter to set argument variables or expanding on environment variables. I am not going more in depth on that right now since I could write an article on that by itself.

[tech-slave@slave ~]$ echo $PATH
/usr/lib/qt-3.3/bin:/usr/kerberos/bin:
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:
/usr/sbin:/sbin:/home/tech-slave/bin

Unlike with Windows the directories are seperated by colons ":" and not semi-colons ";" helping see each location. As with my previous post"Setting Your Prompt for Bash" you can make permanent changes to your BASH by editing the ~/.bashrc file.

Now if you want to add you present working directory (PWD) to PATH for this BASH session you can do so by typing the following command:

PATH=.:$PATH : export PATH

Now you may not want the present working directory (PWD) to PATH and if you want to specify a specific directory you should phrase your command like the following.

Ex: This command refers to my Crossover Office directory where I run Microsoft Excel for certain spreadsheets.

PATH=$PATH:/home/cxoffice/bin : export PATH

This will check will first read the listed directory and add it to path then we export the new modified PATH.

=================================

Now in section three of this (god awful long post) we will tackle the WHATEVER command to provide yourself ways to shortcut to directories on your filesystem to speed up you work in BASH. I have a 'note' directory in my 'Documents' directory within the /home/tech-slave directory. I want to create a quicker way to access it than the following command:

$ cd /home/tech-slave/Documents/note

So I am going to use N to remind me of note and set up the following link:

N=/home/tech-slave/Documents/note : export N

Now I'm going to make that my current directory by typing:

$ cd $N

and there you have it.

More next time, later.

arizona.rune@gmail.com

0 comments:

Pages

Search

Loading...

About Me

AZ-RUNE. Powered by Blogger.

Followers