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 :-)

Saturday, June 13, 2009
I have hit dangerous waters today, treacherous you might say. I have found a hot nerd who seems to appreciate many of the things I do. More to follow, must study... STUDY!!!
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

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.

Saturday, June 6, 2009
Now I am running Fedora 10, on the first HDD and Ubuntu 9.04 on the second HDD so my default BASH prompt has the following parameters:

"Username, Hostname, and the name of the PWD or present working directory" surrounded in brackets.
ex.: [tech-slave@slave ~]$

FYI Note " ~ " is shown to represent your home directory (i.e. ~ = /home/yourusername)

so.. $ cd /bin
[tech-slave@slave bin]$

There are some temporary options that will alter how your prompt appears.

Three examples \t (time) \d (date) \w (displays full path of the PWD)

So to execute the tempory change you would type:
$ export PS1="[\t \d \w]\$ "

Giving you [20:43:33 Sat Jun 06 /bin]$

Now to permanently alter these setting for the prompt then make the changes in your ~/.bashrc file for them to last after you close your current shell. Now in other files you might change a setting but with this one you can just add the line at the end of the file and save the change.

Wednesday, June 3, 2009
Mike(21:44:14): that ninjua tux is my new mascot lol
Brian(21:44:22): hehe
Mike(21:44:37): you stole the jedi i got ninja w00t
Brian(21:45:10): Pirates. Ninjas. A Jedi cares not about this, only the code matters (Open Source that is :^P )
Mike(21:45:28): Wow.. i have nothing, that really was awsome

Sometimes you just win
/etc/profile = Sets up user environment information of every user on the system.

/etc/bashrc = This file executes for every user that runs the BASH shell, each and every time it's opened. Remember though that the values in this file can be over-ridden by each user's ~/.bashrc file.

~ /.bashrc_profile = User specific information on how they choose to use their shell prompt. By default it grabs its environment variables from the user's ~/.bashrc file.

~/.bashrc = Contains the information that is specific to YOUR own bash shells. This file is the best location to add enviroment profiles. Many of the other config files check this or are over-ridden by the values in this file.

~ /.bashrc_logout = Excutes upon a user logging out of BASH, and by default just clears your screen.

The first two files will require sudo (Ubuntu Linux Distro's) or root (Fedora Linux Distro's) permissions to modify. The other files each have a copy in every user's $HOME directory, so they (users) can modify it at their liesure.

Monday, June 1, 2009


About Me

AZ-RUNE. Powered by Blogger.