A Personal Blog
Archive for July, 2003
Changing your bash prompt
Jul 31st
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.
Tryin a new distro!
Jul 31st
Okay…it’s not Linux. Don’t crucify me. But I have decided to part ways (at least temporarily) with my Redhat distro in favor of FreeBSD. I downloaded it yesterday. This weekend I plan to install it. I’m looking for something really cutting edge…
Aaron
For Mattias
Jul 30th
I know how much Mattias loves customer service questions. Recently I decided to change my cell phone from a monthly “pay for minutes in advance” style plan to a “pay as you call” type plan.
I only had 5 issues… (more…)
PSP Goes Wireless!
Jul 30th
It’s official, I will get a PSP (Sony’s new handheld gaming device to compete with the GameBoy Advance). Why? It’s going to be wireless!
Yes, this means you and your mate (s? will it have more multiplayer games than the PS/2?) can be within 5-12 feet of each other and be playing like it’s no big deal. Good stuff.
BuyMusic.com
Jul 30th
http://www.scriptygoddess.com/archives/004057.php
it actually seems like they did it wrong in every single way. (more…)