Directories and Environment Variables

Overview

  • Time: 15 min

  1. Learn about the directories you will need to work with on Gadi.

  2. Understand the environment variables that are set automatically when you log in to the system.

In this section, we will explore the directories you will need to work with on Gadi. Understanding these directories is crucial for managing your files and data effectively.

Home directory is unique to each user and is where you can store your personal files, scripts, and data.

1 echo $HOME

Explanation

Here $HOME is an environment variable that points to the user’s home directory. The value in $HOME is set automatically when you log in to the system, and it is unique to each user.

1 cd $HOME

$USER is an environment variable that contains the username of the currently logged-in user. This is also unique to each user and is set automatically when you log in to the system.

1 echo $USER

Each user belongs to one or more projects on Gadi. You can only access the files and directories that belong to your project(s). To fins out which projects you belong to, you can use the command:

1 echo $PROJECT

Scratch directory is a high-performance storage area designed for temporary data storage during computations. It is typically used for storing intermediate results, large datasets, or files that are not needed long-term. Each project has its own sub directory in the scratch area, which is accessible to all members of the project.

1 cd  /scratch/$PROJECT
2 pwd

Inside the scratch directory, you can create your own subdirectory to store your files.

1 mkdir -p $USER
2 cd $USER
3 pwd

You can aslo set your own environment variable.

1 export MYDIR=$HOME/mydir
2 echo $MYDIR
3 mkdir -p $MYDIR
4 cd $MYDIR
5 pwd

and also clear it when you are done.

1 unset MYDIR
2 echo $MYDIR

Now you can clone the course repository to your home directory or scratch directory.

1 cd  /scratch/$PROJECT/$USER
2 pwd
3 git clone https://github.com/NCI900-Training-Organisation/hpc101.git

Key Points

  • The home directory is unique to each user and is where you can store your personal files, scripts, and data.

  • The $HOME environment variable points to the user’s home directory, and it is set automatically when you log in.

  • The $USER environment variable contains the username of the currently logged-in user.

  • The $PROJECT environment variable contains the project name(s) you belong to, and it is set automatically.

  • The scratch directory is a high-performance storage area for temporary data storage during computations.