link to content
Essentials at NC State Home
skip header navigation and go to content Help | ResNet | Computing@NC State | For OIT Staff | Publications | Search NC State | Feedback | Site Map
your unity account
antivirus & security
email & messaging
connections & labs
your computer
software@nc state
files
web pages
education & training
publications
other resources
troubleshooting
ITD Sections

Customizing your prompt

You can customize your prompt by placing a "set prompt=" line in your ".mycshrc" file. For example, if you want your prompt to reflect the directory you are in, you would place the line

set prompt = "[%C]...>"

in your ".mycshrc" file.

After you use the command source .mycshrc to reload the values in your ".mycshrc" file, your prompt will be in the style of:

[pkandrog]...>

Just enclose what you want your prompt to be in quotes, unless it is a single word:

set prompt=myname

To make your prompt reflect values such as the current directory, time or date, you need to use the automatic variables provided by Unix.

Some of the available values are:


   %d or %/    Current working directory.

   %c or %.    Trailing component of cwd, may be
               followed by a digit to get more than one
               component, if it starts with $HOME, that
               part is replaced with a ~.

   %C          Trailing component of cwd, may be followed
               by a digit to get more than one component, no
               ~ substitution.

   %M          The full machine hostname.

   %m          The hostname up to the first ".".

   %t or %@    Current time of day, in 12-hour, am/pm format.

   %T          Current time of day, in 24-hour format.
               (But see the ampm shell variable below.)

   %n          The user name, contents of $user.

   %w          The date in dd format.

   %W          The date in mm/dd/yy format.

   %D          The date in yy-mm-dd format.

   %l          The line (tty) the user is logged on.

Examples

set prompt = "[%C]...>"
    Results in a prompt of: [pkandrog]...>

set prompt = "Pat...%C...>"
    Results in a prompt of: Pat...pkandrog...>

set prompt = "%t...%C...>"
    Results in a prompt of: 5:40pm...pkandrog...>

set prompt = "%M...%C...>"
    Results in a prompt of: P25.cc.ncsu.edu...pkandrog...>

 

Last modified June 15, 2005 by cawalker

jump back to content/page ends, begin footer
jump to content
jump to content Go to page top Page Top | Site Map | OIT | Policy Disclaimer | Site Survey