...
The great thing about this prompt is that it always tells you where you are, which avoids having to issue the pwd (present working directory) command all the time. Execute these commands to see how the prompt reflects your current directory:. (Don't just copy-and-paste here because we've included the prompt.)
Code Block | ||
---|---|---|
| ||
stamp:~$ mkdir -p tmp/a/b/c stamp:~$ cd tmp/a/b/c stamp:~/tmp/a/b/c$ |
...
Your profile has also installed nice directory colors, which you can see when you list your home directory:
Code Block | ||||
---|---|---|---|---|
| ||||
cd ls |
So why don't you see the .profile_user file you copied to your home directory? Because all files starting with a period ("dot files") are hidden by default. To see them add the -a (all) option to ls:
...
We list its content to the Terminal with the cat (concatenate files) command:
Code Block | ||||
---|---|---|---|---|
| ||||
cat .profile_user |
...
You'll see the following (you may need to scroll up a bit to see the beginning):
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/bash # Change the command line prompt to contain the current directory path if [ "$TACC_SYSTEM" == "stampede" ]; then PS1='stamp:\w$ ' else PS1='lstar:\w$ ' fi # Try to ensure all created files can be read/writtin by group members umask 002 # Make common, useful software always available module load python; module load launcher # Set the default project allocation for launcher_creator.py export ALLOCATION=genomeAnalysis # Environment variables for useful locations export BI=/corral-repl/utexas/BioITeam export CLASSDIR="$BI/core_ngs_tools" # Add current directory and $HOME/local/bin to PATH export PATH=.:$HOME/local/bin:$PATH # Use yellow for directories, not that horrible blue dircolors .dircolors > /dev/null |
...
The first line is the "she-bang". It tells the shell what program should execute this file – in this case, bash itself – even though the expression is inside a shell comment (denoted by the # character).
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/bash |
...
The profile also sets an environment variable named BI to point to the shared directory: /corral-repl/utexas/BioITeam, and another environment variable named CLASSDIR to point to the specific sub-directory for our class.
Code Block | ||||
---|---|---|---|---|
| ||||
# Environment variables for useful locations export BI=/corral-repl/utexas/BioITeam export CLASSDIR="$BI/core_ngs_tools" |
...
You can use these environment variables to shorten typing, for example, to look at the contents of the shared BioITeam directory as shown below.
Code Block | ||||
---|---|---|---|---|
| ||||
# hit Tab once after typing $BI/ to expand the environment variable ls $BI/ # now hit Tab twice to see the contents of the directory ls /corral-repl/utexas/BioITeam/ # now type "co" and hit Tab again ls /corral-repl/utexas/BioITeam/co # your command line should now look like this ls /corral-repl/utexas/BioITeam/core_nge_tools/ # now type "m" and one Tab ls /corral-repl/utexas/BioITeam/core_nge_tools/m # now just type one Tab ls /corral-repl/utexas/BioITeam/core_nge_tools/misc/ # the shell expands as far as it can unambiguously, so your command line should look like this ls /corral-repl/utexas/BioITeam/core_nge_tools/misc/small # type a period (".") then hit Tab twice again -- you're narrowing down the choices ls /corral-repl/utexas/BioITeam/core_nge_tools/misc/small. # finally, hit Tab twice to see possible completions now -- you should see two filenames |
...
When you type a command name the shell has to have some way of finding what program to run. The list of places (directories) where the shell looks is stored in the $PATH environment variable. You can see the entire list of locations by doing this:
Code Block | ||||
---|---|---|---|---|
| ||||
echo $PATH |
...
The complicated looking if statement near the top of your profile is checking whether you're on stampede or lonestar (this .profile_user works on both), and setting up your friendly shell prompt so that it includes the current working directory. This is done by setting the special PS1 environment variable and including a special \w directive that the shell knows means "current directory".
Code Block | ||||
---|---|---|---|---|
| ||||
# Change the command line prompt to contain the current directory path if [ "$TACC_SYSTEM" == "stampede" ]; then PS1='stamp:\w$ ' else PS1='lstar:\w$ ' fi |
...