The terminal and remote login
Total: 30min (Teaching:20Min | Discussion:0min | Breaks:0min | Exercises:0Min | Type-along-pause:10 min )
An active user account on one of the HPC systems (clusters)
Get an user account and access to a project
What is UNIX ?
What is a terminal/Command line/UNIX shell, why do we need it
What do we mean by logging in to a remote system ?
What is ssh
The UNIX terminal
The ssh program
Connect to a remote HPC system.
Introduce the shared document
Short pause for people to log in
Open the shared document and start the discussion, while the learners type in answers
CLI (Command Line Interface)
Before we dive into what CLI is, let’s remind ourselves of how we ask a computer to do something of us.
What are the methods you know for interacting with a computer
Use the interactive document to write down the answers
What is UNIX
UNIX is an Operating System(OS). An operating system is a software that makes a computer usable by managing the hardware, other software and automated tasks that are needed for the computer to work. Windows, MacOS, Android,Chrome OS and Ubuntu are some examples of operating systems. There are different flavors of UNIX, and except Windows, all the other examples above are flavors of UNIX. Versions of Windows 10 and newer have support to executing UNIX commands as well, while older versions do not.
What is a CLI
The CLI (Command Line Interface) also referred to as the Terminal/Command line/UNIX shell or UNIX terminal, is a user interface that interprets text inputs to machine-understandable instructions. Shell is a program(s) that uses this method of interface. There are different variants of the Shells as well and a common one is Bash, which we will focus on during this lesson. In addition to being a CLI, bash is also a scripting language.
We will use the term terminal to refer to the CLI and use the bash flavor of the shell
Why do we need to use the terminal
Efficient way to achieve complex tasks. Some examples;
Rename 1000 files by prepending the string “latest” to their names
Group a collection of RAW, PNG and JPG files in sub-folders by their type
Extract the first 10 lines of 100 files and place it in a new file
Count how many lines start with a “>” in a file with 1 million lines. Then extract those matching lines to a new file.
Work on remote computers
Pipelines: combine multiple commands to achieve a repetitive task
Try to show how to locate the terminal using different methods and on different operating systems if possible.
Find my terminal
Most of the operating system flavors will bring up the default terminal using one of the two methods described below.
Do not worry if your default terminal does not support all
commands we will be using in this lesson, as we will use the default terminal only to establish connection to the
remote HPC system. The rest of the commands will be executed on the remote HPC system itself.
ALT + CTRL + T(press down ALT key, CTRL key and then press the T)
In the program search box type
If the above methods failed to locate the terminal, then do an internet search “how to open terminal on MY-OS-NAME” where MY-OS-NAME is the operating system you are on.
If you are on an older Windows version (Windows 7) you could download the program called Git SCM to Windows and that will be your terminal to connect to the HPC system.
Use interactive document to vote for I found my terminal or I can not find my terminal
What is SSH (Secure Shell)
SSH is a protocol (established set of rules) used to make it possible for two computers to securely communicate over a network (internet is a (huge) network).
ssh - protocol and client/program
In this lesson we will be referring to the
ssh command when we say SSH, which is
actually a SSH client. You could think of
ssh as a program that could establish
a connection to a remote machine that supports SSH connection
(a machine that runs the SSH server).
Logging in to a remote HPC system
The first step in using a cluster is to establish a connection from our laptop to the cluster,
via the Internet and/or your organization’s network. We will use
ssh for this.
Make sure you have a SSH client installed on your laptop terminal.
Test if ssh is installed before proceeding
Check ssh version
[user@laptop ~]$ ssh -V
OpenSSH_x.x xx, OpenSSL xxx xxx
ssh installed and OK to continue
[user@laptop ~]$ ssh -V
Command ‘ssh’ not found
Not OK! stop and inform instructor
Use the interactive document to vote for
I have ssh
I do not have ssh
I am lost, what you mean by ssh
Go ahead and log in to the cluster:
Remember to replace
MY_USER with the username you received after registering
for an account. You will be asked for your password.
The characters you type after the password prompt are not displayed on
the screen. Normal output will resume once you type the password and press
[user@laptop ~]$ ssh MY_USER_NAME@saga.sigma2.no
[user@laptop ~]$ ssh MY_USER_NAME@fram.sigma2.no
[user@laptop ~]$ ssh MY_USER_NAME@betzy.sigma2.no
[user@laptop ~]$ ssh MY_USER_NAME@fox.educloud.no
You are logging in using
ssh. This establishes a temporary encrypted connection
between your laptop and
compute cluster. The word before the
MY_USER_NAME here, is the user account name that you have permission to use on the
Where are we?
Very often, many users are tempted to think of a high-performance computing installation as one
giant, magical machine. Sometimes, people will assume that the computer they’ve logged onto is the
entire computing cluster. So what’s really happening? What computer have we logged on to? The name
of the current computer we are logged onto can be checked with the
hostname command. (You may also
notice that the current hostname is also part of our prompt!)
[MY_USER_NAME@login-1.SAGA ~]$ hostname
[MY_USER_NAME@login-1.BETZY ~]$ hostname
[MY_USER_NAME@login-4 ~]$ hostname