Hoffman2:Profile: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[Hoffman2|Back to all things Hoffman2]] | [[Hoffman2|Back to all things Hoffman2]] | ||
In UNIX systems, there are certain configuration files that get executed every time you login. If you are using the Bash shell (default), you have a file called <code>.bash_profile</code> which is processed when you log in. In order to make the FMRI toolset available to you on Hoffman2 and so you can work well with others, we recommend that you follow the instructions in the [[Hoffman2:Profile#Basics|Basics section]]. Read [[Hoffman2:Profile#Extras|Extras]] for some bells and whistles. | |||
==Basics== | ==Basics== | ||
Line 5: | Line 8: | ||
# [[Hoffman2:Accessing the Cluster#SSH - Command Line|SSH into Hoffman2]] | # [[Hoffman2:Accessing the Cluster#SSH - Command Line|SSH into Hoffman2]] | ||
# Use your favorite [[Text Editors|text editor]] to edit the file <code>~/.bash_profile</code> | # Use your favorite [[Text Editors|text editor]] to edit the file <code>~/.bash_profile</code> | ||
#: <pre>$ vim ~/.bash_profile</pre> | #: [[Text Editors#Vim (H2) (OSX)|VIM]] | ||
#: | #:* <pre>$ vim ~/.bash_profile</pre> | ||
#: <pre>$ emacs ~/.bash_profile</pre> | #: [[Text Editors#Emacs (H2) (OSX)|Emacs]] | ||
#:* <pre>$ emacs ~/.bash_profile</pre> | |||
#: [[Text Editors#NEdit (H2) (OSX)|NEdit]] | |||
#:* <pre>$ nedit ~/.bash_profile</pre> | |||
# Insert these lines at the '''bottom''' of the file | # Insert these lines at the '''bottom''' of the file | ||
#: <pre>source /u/home/FMRI/apps/etc/profile umask 007</pre> | #:* <pre>source /u/home/FMRI/apps/etc/profile umask 007</pre> | ||
#: [[Text Editors#Vim (H2) (OSX)|VIM]] | |||
#:* Type <code>G</code> - capital G - to go to the end of the file | |||
#:* Type <code>A</code> - capital A - to go to the end of the line and enter insert mode | |||
#:* Type <code>ENTER</code> - to insert a newline | |||
#:* Type or paste in the specified lines. | |||
#: [[Text Editors#Emacs (H2)(OSX)|Emacs]] | |||
#:* Use the arrow keys to scroll the cursor down to the bottom of the document and add a newline. | |||
#:* Type or paste in the specified lines. | |||
#: [[Text Editors#NEdit (H2)|NEdit]] | |||
#:* Use the arrow keys to scroll the cursor down to the bottom of the document and add a newline. | |||
#:* Type or paste in the specified lines. | |||
# Save the file | # Save the file | ||
#: | #: [[Text Editors#Vim (H2) (OSX)|VIM]] | ||
#: | #:* <code>ESC + ":wq" + ENTER</code> | ||
#: | #: [[Text Editors#Emacs (H2) (OSX)|Emacs command line]] | ||
#:: < | #:* <code>CTRL+x, CTRL+c</code> | ||
#: [[Text Editors#Emacs (H2) (OSX)|Emacs GUI]] | |||
#:* <code>CTRL+x, CTRL+c, y</code> | |||
#:* or use the menu system | |||
#: [[Text Editors#NEdit (H2)|NEdit]] | |||
#:* Use the menu. | |||
# Log out of Hoffman2 and the next time you log in, everything will be set for you to start working. | # Log out of Hoffman2 and the next time you log in, everything will be set for you to start working. | ||
Line 42: | Line 64: | ||
;Host | ;Host | ||
: The name of the computer you are logged into. This also helps you know where you are at all times. | : The name of the computer you are logged into. This also helps you know where you are at all times. | ||
===Example=== | |||
Line to add to your bash profile | |||
export PS1="\[\e[0;31m\]\h\[\e[1;37m\]:\[\e[1;34m\]\w\n\[\e[1;37m\]\D{%Y-%m-%d-%H-%M-%S} \[\e[22;32m\]\u\$ " | |||
Result | |||
Revision as of 20:21, 25 April 2012
In UNIX systems, there are certain configuration files that get executed every time you login. If you are using the Bash shell (default), you have a file called .bash_profile
which is processed when you log in. In order to make the FMRI toolset available to you on Hoffman2 and so you can work well with others, we recommend that you follow the instructions in the Basics section. Read Extras for some bells and whistles.
Basics
You account has one last thing that needs to be edited before being usable.
- SSH into Hoffman2
- Use your favorite text editor to edit the file
~/.bash_profile
- Insert these lines at the bottom of the file
source /u/home/FMRI/apps/etc/profile umask 007
- VIM
- Type
G
- capital G - to go to the end of the file - Type
A
- capital A - to go to the end of the line and enter insert mode - Type
ENTER
- to insert a newline - Type or paste in the specified lines.
- Type
- Emacs
- Use the arrow keys to scroll the cursor down to the bottom of the document and add a newline.
- Type or paste in the specified lines.
- NEdit
- Use the arrow keys to scroll the cursor down to the bottom of the document and add a newline.
- Type or paste in the specified lines.
- Save the file
- VIM
ESC + ":wq" + ENTER
- Emacs command line
CTRL+x, CTRL+c
- Emacs GUI
CTRL+x, CTRL+c, y
- or use the menu system
- NEdit
- Use the menu.
- VIM
- Log out of Hoffman2 and the next time you log in, everything will be set for you to start working.
Curious?
For those that care, what you are doing is asking the computer to execute the file
/u/home/FMRI/apps/etc/profile
every time you login. This file modifies your PATH variable so you have access to the FMRI toolset.
The last line
umask 007
makes it so that any files you create will have a default permission of about 770 so that other people in your group have write permissions.
Extras
You can change the content and color of your command prompt by editing your bash_profile. There is a great explanation of how to do this here.
Some of the content you can include in the command prompt:
- Current time
- You can format this however you want. This helps when looking back through your Terminal to find when you made certain changes to files.
- Current working directory
- So you always know where you are in a filesystem and don't need to constantly retype
pwd
. - Username
- Who you are. Helpful if you are logged into multiple servers under multiple accounts and need help keeping track.
- Host
- The name of the computer you are logged into. This also helps you know where you are at all times.
Example
Line to add to your bash profile
export PS1="\[\e[0;31m\]\h\[\e[1;37m\]:\[\e[1;34m\]\w\n\[\e[1;37m\]\D{%Y-%m-%d-%H-%M-%S} \[\e[22;32m\]\u\$ "
Result