The .profile in Cygwin
We have seen a few things about the .profile while customizing the Cygwin terminal. Here are the remaining sections of the file.
Prompt
export PS1=”\[\e]2;\u@\h:\w\007$green\]\u@\h:\[$pink\]\w\[$blue\]$ \[$BLUE\]”
The PS1 is a defined environment variable that determines how a prompt should behave. It stands for “Prompt Settings”. There are three variables \u, \h, and a \w. \u is the username, \h is the hostname, \w is the complete path of the working directory. The pre-defined colors $green, $pink, $blue, $BLUE (set in the .profile shown) specify the color of the display immediately following. Notice that PS1 seems to have a repetition of \u, \h and \w. The first part — until \007 — sets the window name of Cygwin which otherwise would’ve been something like C:\windows\system32\cmd.exe.
There is another environment variable called the PS2 and is secondary and is set to ‘>’ by default. It is displayed whenever you have pressed Return and the command is incomplete.
History
In command prompt, when you press Up arrow, you can find previous commands you’ve typed within that session. In Cygwin, a user-specified log file of a user-specified size logs all commands and that can allow you to easily run previous commands across sessions.
Aliases
alias pingg=’ping www.google.com’
Alias understandably is your nickname to a command. e.g. When you’re connected to a network and want to find out whether there are any problems with the Internet connection (slowdown or disconnect) you can try pinging www.google.com. Because Google is one of those big sites that rarely goes down or is never too slow. The ping gives you an idea. Instead of the complete command you can now just type ‘pingg’. Remember that this alias takes precedence over any previously defined usage of a command with the same name.















Comments
3 Responses to “The .profile in Cygwin”Trackbacks
Check out what others are saying about this post...[...] In case you already use a text editor that you are comfortable with, you can continue to use it from command line in Cygwin itself. Add your text editor with a custom alias in your .profile: [...]
[...] been nearly two months since I introduced Cygwin. We’ve seen how to install Cygwin, customize the terminal, a few text editors and a tabbed terminal emulator. Enough with the playfulness. One final [...]
[...] UNIX-based OSs, a MOTD serves this purpose. Even the .profile may be modified to include the [...]