Terminal

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Job Scheduler:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Job Scheduler:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Job Scheduler:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Job Scheduler:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Job Scheduler:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Database:

  • Job Scheduler:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

  • Utility:

type access

  • Operating System:

  • Terminal:

  • Shell:

  • Editor:

  • Package Manager:

  • Programming Language:

Web terminal interface based on the ttyd command-line tool. This interactive app can be used to install new software and to run scripts.

Basic features

Install new software

The default user inside the application container is ucloud, which has also superuser account privileges. Therefore, full read, write, and execute permissions are enabled using sudo in front of any command, without entering an administrator password.

Before installing new software, it is always recommended to update the system libraries. For example, to install the GCC compiler one should run the commands:

$ sudo yum update -y
$ sudo yum install -y gcc

for the CentOS releases, and

$ sudo apt-get update -y
$ sudo apt-get install -y gcc

for the Ubuntu releases.

Note

The Initialization optional parameter can be used to execute a Bash script to install system libraries before starting the terminal session.

Run a script in batch mode

The optional parameter Batch processing is used to run a Bash script (.sh) when the job starts. In this case, the job ends immediately after executing the program.

Connect to a remote server

The Terminal app allows to establish secure connection to a remote server via an SSH client. In this case the authentication is done using an SSH private key stored on UCloud. The corresponding public key must be uploaded to the remote server. Instructions about how to generate a new SSH key can be found here.

For example, if the private key id_rsa is located inside a folder called ssh-key, the user has to mount it before launching the app. The permissions of the file should be set as follows:

$ chmod 400 /work/ssh-key/id_rsa

It is now possible to connect to the remote server from the web terminal interface using the command:

$ ssh -i /work/ssh-key/id_rsa user@hostname

where user indicates the user identification on the remote server, while hostname denotes the remote server IP address.

Attach a public IP

The app supports deployment with a static IP address. The optional parameter SSH public key can be used for SSH authentication when connecting from a remote server.

Note

Public IPs are not currently supported with multiple nodes.

Change the default shell

Keyboard shortcuts

  • Restart the session : Ctrl-d

  • Clear the screen : Ctrl-l

  • Stop the currently running command : Ctrl-c

  • Move to the beginning of line : Ctrl-a

  • Move to the end of line : Ctrl-e

  • Move backward one character : Ctrl-b

  • Move forward one character : Ctrl-f

  • Move backward one word : Esc-b

  • Move forward one word : Esc-f

  • Swap the last two words : Esc-t

  • Delete one character before the cursor : Ctrl-h

  • Delete all characters after the cursor : Ctrl-k

  • Delete all characters before the cursor : Ctrl-u

  • Display the previous line in command history : Ctrl-p

  • Reverse search : Ctrl-r

  • Swap the last two characters : Ctrl-t

  • Delete the words before the cursor : Ctrl-w

  • Retrieve last deleted item : Ctrl-y

  • Stop the current command : Ctrl-z


The shell type can be selected at the job startup by using the option Shell available in the app front-end page. By default the app starts a bash shell. The pre-configured shell types may depend on the Linux distribution.

Once logged into the terminal window interface, the name of the working folder is displayed next to the default user. In case of a Git repository, the name of the current branch is highlighted, as shown below.

drawing
Advanced features of the default shell prompt are listed [here](https://starship.rs/config/).

Start a tmux session

Key bindings

  • List keyboard shortcuts : Ctrl-a ?

  • Rotate panels : Ctrl-a o

  • Move to left panel : Ctrl-a h or Ctrl-a <Left>

  • Move to lower panel : Ctrl-a j or Ctrl-a <Down>

  • Move to upper panel : Ctrl-a k or Ctrl-a <Up>

  • Move to right panel : Ctrl-a l or Ctrl-a <Right>

  • Move to last panel : Ctrl-a ;

  • Zoom selected panel : Ctrl-a +

  • Change panels arrangement : Ctrl-a <Space>

  • Horizontal split : Ctrl-a |

  • Vertical split : Ctrl-a -

  • Detach session : Ctrl-a d

  • Create new window : Ctrl-a c

  • Move to next window : Ctrl-a n

  • Move to previous window : Ctrl-a p

  • Close panel/window : Ctrl-a & or Ctrl-d

  • Select window : Ctrl-a <0-9>

  • Synchronize panels : Ctrl-a Shift-e

  • Open configuration file : Ctrl-a e

  • Enable vertical scrolling : Ctrl-a [ or Ctrl-a PgUp

  • Enable mouse support: Ctrl-a m

  • Switch session : Ctrl-a s


tmux is a terminal multiplexer, that is it allows to open multiple windows inside the same session. It makes easy to switch between multiple programs in one terminal window, detach them and reattach them to a different terminal.

A new tmux session is started with the command:

$ tmux new -s session_name

Alternatively, one can use the optional parameter Enable tmux, which will automatically start a new tmux session within the selected shell type.

An example is shown in the figure below. In this case the current session contains five windows, with the active one divided into five panels. To move between different windows and panels, one should use the key bindings listed above.

drawing
The list of all the active tmux sessions is given by:
$ tmux list-sessions

An active tmux session can be attached to multiple browsers with the command:

$ tmux attach -t <session_name>

This is useful to resume a session previously running in another window. The current session can be detached using the key combination: Ctrl-a d . Alternatively, from a new browser window, run the command:

$ tmux detach-client -s <session_name>

Advanced features

These features are available only in few releases of the Terminal app.

Environment modules

The Lmod environment module system is used to configure and load environment settings with modulefiles as well as manage multiple versions of the same software.

To see a list of available software modules run the command:

$ module avail

or

$ module spider

To load a module, use the command: module load <module_name>. The default version will automatically be loaded. To select a particular version, use instead: module load <module_name>/<module_version>.

The list of currently loaded modules is shown with the command:

$ module list

To unload a specific module, use the command: module unload <module_name>. This command will automatically unload all its dependencies as well. To unload everything, use:

$ module purge

More commands can be read in the official documentation.

EasyBuild

EasyBuild is a software build and installation framework written in Python, which allows to deploy and manage many scientific applications and tools on HPC systems. The EasyBuild module is loaded by default when the terminal session starts:

$ module list

Tip

Currently Loaded Modules:
 \1) EasyBuild/4.3.3

The dependencies and build parameters of each software release are specified in the corresponding EasyBuild easyconfig files.

To search for all available easyconfig files, use the option --search (or -S). For example:

$ eb -S '^Python-3.6.6-*'

Tip

CFGS1=/opt/easybuild/easyconfigs/p/Python
 * $CFGS1/Python-3.6.6-foss-2018b.eb
 * $CFGS1/Python-3.6.6-fosscuda-2018b.eb
 * $CFGS1/Python-3.6.6-intel-2018b.eb
 * $CFGS1/Python-3.6.6-iomkl-2018b.eb

Each file specifies the installation parameters for a compiler toolchain.

The eb command is used to install new software from the corresponding easyconfig file. To check all the software dependencies, use the option --dry-run (or -D). For example:

$ eb Python-3.10.4-GCCcore-11.3.0.eb -D

Tip

== temporary log file in case of crash /tmp/eb-9rE3Ix/easybuild-yWJqtE.log Dry run: printing build status of easyconfigs and dependencies
CFGS=/opt/easybuild/easyconfigs
 * [ ] $CFGS/m/M4/M4-1.4.19.eb (module: M4/1.4.19)
 * [ ] $CFGS/p/pkgconf/pkgconf-1.8.0.eb (module: pkgconf/1.8.0)
 * [ ] $CFGS/o/OpenSSL/OpenSSL-1.1.eb (module: OpenSSL/1.1)
 * [ ] $CFGS/b/Bison/Bison-3.8.2.eb (module: Bison/3.8.2)
 
 * [ ] $CFGS/p/Python/Python-3.10.4-GCCcore-11.3.0.eb (module: Python/3.10.4-GCCcore-11.3.0)
== Temporary log file(s) /tmp/eb-9rE3Ix/easybuild-yWJqtE.log* have been removed.
== Temporary directory /tmp/eb-9rE3Ix has been removed.

All the dependencies marked with [ ] will be installed recursively with the option --robot (or -r). By default, new software is installed in $EASYBUILD_INSTALLPATH.

In order to export on UCloud new modules installed with EasyBuild, it is necessary to specify a different installation path within the default work tree. For example:

$ eb --installpath=/work/easybuild Python-3.10.4-GCCcore-11.3.0.eb -r

In this case the software and its dependencies will be installed in the folder /work/easybuild, which is saved in the job output folder. To load the software modules when submitting a new job, the user should select the easybuild folder using the optional parameter Modules path. This will update the default MODULEPATH environment variable within the shell configuration.

Alternatively, the user can mount it as any other folder and run the following command within a terminal session:

$ module use /work/easybuild/modules/all

For more advanced use of EasyBuild, check out the official documentation.

Create a Slurm cluster

Some releases of the Terminal app are configured for multi-node deployment. In this case the number of nodes is specified using the corresponding parameter in the app front-end page.

The Slurm workload manager is installed and configured in the app to allow for the job scheduling and resource distribution on multiple nodes. A Slurm cluster can be instantiated using the corresponding optional parameter. Alternatively, one can use the command:

$ init_slurm_cluster

The controller node is always node0, which is also used as a compute node. Therefore, Slurm can also be run on a single node. All additional nodes are named sequentially. For example, a cluster consisting of three full u1-standard nodes is configured as follows:

$ sinfo -N -l

Tip

NODELIST   NODES PARTITION     STATE CPUS   S:C:T MEMORY
node0         1     CLOUD*     idle   64   1:64:1 385024
node1         1     CLOUD*     idle   64   1:64:1 385024
node2         1     CLOUD*     idle   64   1:64:1 385024

Jobs can be submitted with either one of the following commands: srun, salloc or sbatch. For example:

$ sbatch my_script.batch

A minimal job script is reported below.

#!/bin/bash
#SBATCH --nodes 1                 # number of nodes
#SBATCH --ntasks-per-node 1       # number of cores per node
#SBATCH --time 2:00:00            # max time (HH:MM:SS)

for i in {1..10000}; do
echo $RANDOM >> random.txt
done

sort random.txt

More configuration options and tutorials can be found here.