image ResEx Logo
ResExcellence www : Powered by Google
Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets


Files are in Stuffit 5 or greater format.
Free download.

Tell us about a bad link.

Thank You!


Running 55 days
without a restart.

Changing the Terminal Prompt by hoshi

Update: Hoshi's article on customizing the command prompt has sparked some additional comments. Paul Woodford adds:

Were you aware that tcsh has many different formatting sequences available for the prompt? You can read about them in the description of the prompt variable in the "Special shell variables" section on the tcsh man page (Type man tcsh in a terminal window). Note that the man page is very long, and this information is about 2/3 of the way through. There is also an rprompt variable for a right hand side prompt.

For instance, I use the following settings:

set prompt = '%B%m:%c03%#%b '
set rprompt = '%B%p%b'
<-- this places the current time in the left margin



In today's tip, you'll learn how to customize the terminal prompt by adding a couple of special text files.

First, make a plain text document called .login in your Home folder (note the file name begins with a dot to make it invisible!). Copy the following text and past it into that document:

alias cd 'chdir \!$; source ~/.setprompt'

Now make another plain text document in your Home folder called .setprompt and paste in the following text (again, note the file name begins with a dot to make it invisible):

#!/bin/csh
# file: .setprompt
# assign the prompt variable multiple lines
# escape (quote) the newline each time

set prompt = "\

# pwd = print working directory
`pwd`\

# This is the prompt. Feel free to customize.
x--> "

Re-login to your computer and run the Terminal app.

Now whenever you change directories you will see a new prompt displaying the current directory path. For example, type this in the terminal:

cd ~/desktop

The prompt will now show something like this:

/Users/hoshi/Desktop
x-->

Have fun by experimenting and changing the prompt!

Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement. [an error occurred while processing this directive]