Ok, here we go again you Windows users gone Linux!

I realize comfort level is at a premium here and you wish everything could be done from a GUI. Shame on you for thinking that. I said Linux was better, not easier! Sheesh.

Ok, so we can help you feel more comfortable, even at the commandline. Hell, this will even make you a better person when dealing with secure shell in your shared hosting environment.

Today’s tip – making the bash prompt friendlier.

So you fire up your old secure shell client from OpenSSH and you login. Upon authentication, you are greeted by a prompt like this:

bash-2.04$

Because you are used to a C prompt, let’s try to make this easier for you. Note-we are only changing the appearance of the shell prompt. This is not really the C drive.

Let’s move on. Are you ready? you might want to grab a seat. Ok, there we go.

export PS1="C:\>"

What does this do? Very simply, it overwrites the PS1 environment variable that is currently set as bash-2.04$ and sets it as C:\>.

You can also include lots of dynamic info in the prompt as well.

export PS1="\u@\w>"

will display the username@currently working directorylook like:

sketch@/home/sketch/public_html

There are plenty of other dynamic variables that can be used in bash as well. Try some of these:

\a The ASCII bell character (you can also type \007)
\d Date in “Wed Sep 06″ format
\e ASCII escape character (you can also type \033)
\h First part of hostname (such as “mybox”)
\H Full hostname (such as “mybox.mydomain.com”)
\j The number of processes you’ve suspended in this shell by hitting ^Z
\l The name of the shell’s terminal device (such as “ttyp4″)
\n Newline
\r Carriage return
\s The name of the shell executable (such as “bash”)
\t Time in 24-hour format (such as “23:01:01″)
\T Time in 12-hour format (such as “11:01:01″)
\@ Time in 12-hour format with am/pm
\u Your username
\v Version of bash (such as 2.04)
\V Bash version, including patchlevel
\w Current working directory (such as “/home/drobbins”)
\W The “basename” of the current working directory (such as “drobbins”)
\! Current command’s position in the history buffer
\# Command number (this will count up at each prompt, as long as you type something)
\$ If you are not root, inserts a “$”; if you are root, you get a “#”
\xxx Inserts an ASCII character based on three-digit number xxx (replace unused digits with zeros, such as “\007″)
\\ A backslash
\[ This sequence should appear before a sequence of characters that don't move the cursor (like color escape sequences). This allows bash to calculate word wrapping correctly.
\] This sequence should appear after a sequence of non-printing characters.

Happy Switching.