By default, the terminal header is a bit boring and unattractive. This format is determined by your ~/.bashrc file. By default there will be many lines, most of which don't matter. We want the PS1 line (which determines what to show) looks like the following:
Code:
PS1='[\u@\h \W]\$ '
The PS1 line will show anything between the opening and closing ' , including spaces. You have many option of what to put, all listed here:
Code:
\a an ASCII bell character (07)
\d the date in "Weekday Month Date" format (e.g., "Tue May 26")
\D{format}
the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format
results in a locale-specific time representation. The braces are required
\e an ASCII escape character (033)
\h the hostname up to the first `.'
\H the hostname
\j the number of jobs currently managed by the shell
\l the basename of the shell's terminal device name
\n newline
\r carriage return
\s the name of the shell, the basename of $0 (the portion following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\A the current time in 24-hour HH:MM format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patch level (e.g., 2.00.0)
\w the current working directory, with $HOME abbreviated with a tilde
\W the basename of the current working directory, with $HOME abbreviated with a tilde
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a $
\nnn the character corresponding to the octal number nnn
\\ a backslash
\[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into
the prompt
\] end a sequence of non-printing characters
You may put them in any order that you wish, as long as that they are within you're ' s. You may also use colors if you so wish, a full list of colors is below:
Code:
Black 0;30 Dark Gray 1;30
Blue 0;34 Light Blue 1;34
Green 0;32 Light Green 1;32
Cyan 0;36 Light Cyan 1;36
Red 0;31 Light Red 1;31
Purple 0;35 Light Purple 1;35
Brown 0;33 Yellow 1;33
Light Gray 0;37 White 1;37
My PS1 line looks as follows:
Code:
PS1='\[\e[0;34m\][\W]\[\e[m\] '
which, based on the above tables means to use blue to show the current directory, and then switch pack to the default color ([\e[m\] for the rest of the output. There are no limits to how short or long you make this line, a good example line is as follows:
Code:
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$ \[\e[m\]\[\e[1;37m\] '
Of course these aren't the only functions of the ~/.bashrc file, but as far as the header goes, those are your options to what will show.
**If any of this makes no sense, please let me know and I'll try to expand it.
Bookmarks