Globus Command Line Interface

Globus Command Line Interface (CLI) provides an interface to Globus services from the shell and can be incorporated into scripts or used interactively. The CLI allows users to transfer files and manipulate directory structures on a remote endpoint without use of the web interface.

Here, the term “Endpoint” is used instead of “Collection”, but in this context they are interchangable. Although Globus has switched to using the term “collection” on the transfer portal, the cli described here still uses “endpoint”.

Connecting to Globus on the Command Line

To establish a Globus connection, a user must connect their HCC account to their Globus account. To do so, follow these steps:

  1. Connect to the desired HCC cluster.
  2. Load the Globus CLI module:

    module load globus-cli 

  3. Use the command globus login to start the authorization procedure. A web address will be displayed on screen. Copy and paste this URL into your browser.

  4. If you are not already logged into Globus, do so now.

  5. Label the connection if desired, then click Allow to grant Globus the permissions outlined on the screen.

  6. Copy the Authorization Code and paste it into the prompt in your terminal.

  7. At this point, you can verify you are logged in:

    globus whoami

    If you have logged in, you will see your email address displayed. If not, the message No login information available will be displayed.

  8. To terminate your Globus connection:

    globus logout

Activating a Globus Endpoint

To find available endpoints:

globus endpoint search search_term

Where search_term is replaced with the keyword you wish to search for. For example:

globus endpoint search hcc

will display any endpoint with “hcc” in it’s Display Name.

To use the endpoint, you can refer it it by it’s UUID number. To activate an endpoint, use the command globus endpoint activate --web:

Copy the given URL and paste it into the address bar of your web browser. If you are not already logged into the Globus website, you will be prompted to do so. Once you are logged in, you need to click the Activate Now button to activate the endpoint.

Once an endpoint is activated, it will remain activate for 7 days. You can now transfer and manipulate files on the remote endpoint.

To make it easier to use, we recommend saving the UUID number as a bash variable to make the commands easier to use. For example, we will continue to use the above endpoint (Swan) by assigning its UUID code to the variable swan as follows:

This command must be repeated upon each new login or terminal session unless you save these in your environmental variables. If you do not wish to do this step, you can proceed by placing the correct UUID in place of whenever you see $swan.

Endpoint Manipulation

Globus CLI supports the commands mkdir, rename, and ls. All globus commands follow the format globus <command> <endpoint>:<file_path>. We can list the files on the remote endpoint with the command globus ls. To list the files in the home directory on the remote endpoint, we would use the following command:

To make a directory on the remote endpoint, we would use the globus mkdir command. For example, to make a folder in the users work directory on Swan, we would use the following command:

To rename files on the remote endpoint, we can use the globus rename command. To rename the test file we just created above, we would use the command:

Single Item Transfers

All transfers must take place between Globus endpoints. Even if you are transferring from an endpoint that you are already connected to, that endpoint must be activated in Globus. Here, we are transferring between Attic and Swan. We have activated the Swan endpoint and saved its UUID to the variable $attic as we did for $swan above.

To transfer files, we use the command globus transfer. The format of this command is globus transfer <endpoint1>:<file_path> <endpoint2>:<file_path>. For example, here we are transferring the file testfile.txt from the home directory on Swan to the home directory on Swan:

You can then check the status of a transfer, or delete it all together, using the given Task ID:

To transfer entire directories, simply specify a directory in the file path as opposed to an individual file. Below, we are transferring the output directory from the home directory on Swan to the home directory on Swan:

For additional details and information on other features of the Globus CLI, visit Command Line Interface (CLI) Examples in the Globus documentation.

Disabling email notifications

By default, Globus will send an email notification for every successful transfer. For large numbers of transfers, this may become overwhelming. Use the CLI, these notifications can be disabled entirely, or only sent for specific conditions (i.e. failed transfers only). To disable all notifications, run

globus transfer --notify off

For details on additional notify options, see the transfer command documentation.