| Table of Contents |
|---|
...
- Macs and Linux have a Terminal program built-in – find it now on your computer
- Windows 10 or later has ssh and scp in Command Prompt or PowerShell(may require latest Windows updates)
- Open the Start menu → Search for Command
- Open the Start menu → Search for Command
| Expand | ||
|---|---|---|
| ||
If your Windows version does not have ssh in Command Prompt or PowerShell:
More advanced options for those who want a full Linux environment on their Windows system:
|
From now on, when we refer to "Terminal", it is either the Mac/Linux Terminal program, Windows Command Prompt or PowerShell, or the PuTTY program.
...
- Answer yes to the SSH security question prompt
- this will only be asked the 1st time you access ls6
- Enter the password associated with your TACC account
- for security reasons, your password characters will not be echoed to the screen
- Get your 2-factor authentication code from your phone's TACC Token MFA app, and type it in
| Expand | ||
|---|---|---|
| ||
If you're using PuTTY as your Terminal from Windows:
|
...
When you login via an interactive shell, a well-known script is executed to establish your favorite environment settings. The well-known filename is ~/.bashrc (or ~/.profile on some systems), which is specific to the bash shell.
We've pre-created precreated a common login script for you that will help you know where you are in the file system and make it easier to access some of our shared resources. To set it up, perform the steps below:
...
| Code Block | ||
|---|---|---|
| ||
# mkdir -p says to create all parent directories in the specified path mkdir -p ~/tmp/a/b/c cd ~/tmp/a/b/c # Your prompt should look like this: ls6:~/tmp/a/b/c$ c$ |
The prompt now tells you you are in the c sub-directory of the b sub-directory of the a sub-directory of the tmp sub-directory of your Home directory ( ~ ). Type tree ~/tmp to see the tree-like structure of your ~/tmp directory.
Your login script has configured this command prompt behavior, along with a number of other things.
...
| Tip |
|---|
$WORK and $SCRATCH are TACC environment variables that refer to your Work and Scratch file system areas – more on these file system areas soon. (Read more about Environment variables) |
...
| Expand | |||||||
|---|---|---|---|---|---|---|---|
| |||||||
The ln -s command creates a symbolic link, a shortcut to the linked file or directory.
Want to know where a link points to? Use ls with the -l (long listing) option.
|
...
Since our ~/.bashrc login script added ~/local/bin to our $PATH, we can call any script or command in that directory with just its file name. And Tab completion works on program names too:
| Code Block | ||
|---|---|---|
| ||
cd
# hit Tab once after typing "laun"
# This will expand to launcher_creator.py
|
Details about your login script
Let'
Details about your login script
Let's take a look at the contents of your ~/.bashrc login script, using the cat (concatenate files) command. cat simply reads a file and writes each line of content to standard output (here, your Terminal):
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
# hit Tab once to expand the environment variable name
ls $BIW
# hit Tab again to expand the environment variable
ls $BIWORK/
# now hit Tab twice to see the contents of the directory
ls /work/projects/BioITeam/
# type "pr" and hit Tab again
ls /work/projects/BioITeam/pr
# type "co" and hit Tab again
ls /work/projects/BioITeam/projects/co
# type "Co" and hit Tab again
ls /work/projects/BioITeam/projects/courses/Co
# your command line should now look like this
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/
# now type "mi" and one Tab
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/mi
# your command line should now look like this
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/
# now hit Tab once
# There is no unambiguous match, so hit Tab again
# After hitting Tab twice you should see several filenames:
# fastqc/ small.bam small.fq small2.fq
# now type "sm" and one Tab
# your command line should now look like this
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small
# type a period (".") then hit Tab twice again
# You're narrowing down the choices -- you should see two filenames
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small
# small.bam small.fq
# finally, type "f" then hit Tab again. It should complete to this:
ls /work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small.fq |
Extending the $PATH
...
And Tab completion works on program names too:
| Code Block | ||
|---|---|---|
| ||
cd
# hit Tab once after typing "laun"
# This will expand to launcher_creator.py
|
Extending the $PATH
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 | ||||
|---|---|---|---|---|
| ||||
export PATH=.:$HOME/local/bin:$PATH |
| Expand | |||||
|---|---|---|---|---|---|
| |||||
Here's a little command line trick to list the directories on your $PATH on separate lines, using the sed (string editor) program:
sed's string substitution pattern 's/:/\n/g' says to substitute all occurrences (the last g = global modifier) of the colon character : with the "character" \n, which is a newline. |
Setting up the friendly command prompt
...