| Erik's linux page: Linux information for beginners and advanced users | ||
|---|---|---|
| Prev | Chapter 2. Some general words about Linux, mostly for new users. | Next |
Customizing your prompt.
This is a little bells and whistles, but very nice to know..
When you've installed your Linux distribution (I recommend Debian), your prompt probably won't look as you want it. The key to changing this is the PS1 environment variable. This is specific for the common shell bash (I think). You make your own prompt by combining some codes in the variable, just like in the (old good ?) DOS days... here is what you can use:
Table 2-3. Codes to use to format your prompt
| \a | Bell (makes Linux beep every time it shows a prompt, not recommended !) |
| \d | Todays date |
| \e | ESC character, useful if you want to send ansi sequences |
| \h | Your hostname, to the first '.' |
| \H | Your fully qualified hostname |
| \n | newline |
| \s | The name of the shell |
| \t | The current time in 24 hour format |
| \T | The current time in 12 hour format |
| \@ | The current time in 12 hour am/pm format |
| \u | The username of the current user |
| \v | The version of bash |
| \w | The current working directory. |
| \W | The basename of the current working directory (ie /usr/local will be local) |
| \! | The history number of this command |
| \# | The command number of this command |
| \\ | A backslash |