Abhigyan Chakraborty

Linux Essentials for HPC and Remote Servers

Phase 2: The Research Infrastructure — Part 1

(Part 5 of series Blueprint for a Modern Research Computing Environment)

Follow me :

LinkedIn    Website    Website


Quick Summary

Unlike previous parts, this article serves as a map rather than a build tutorial. It covers directory organization, file management, permissions, installing system software with apt, environment variables, SSH, and the basics of HPC clusters and SLURM job submission — the concepts researchers need once they move beyond their local machine to remote servers.


Objective

In previous parts, you built a concrete environment on your local machine. Here, the goal is different: this is a map. As a researcher, you’ll eventually work on remote servers and university HPC (High Performance Computing) clusters. This article provides the foundational knowledge needed to navigate these environments confidently.

By the end, you’ll have:


Content

💡 Getting Unstuck (Expand for AI Troubleshooting Prompts)

AI tools (like Claude, Grok, Gemini, or ChatGPT) give the best troubleshooting advice when they have the exact text of the tutorial. To ensure the AI understands what you are trying to build, we will give it the actual file.

1. Download the tutorial file

2. Upload it to your AI

3. Ask for Help Copy and paste this exact prompt into the chat along with your file:

I have attached the markdown file for the tutorial I am following. Please read it so you understand the specific environment I am trying to build.

I need help with the following:

Step [X]: [paste exact step text from the blog]

Command I ran: [paste exact command]

What happened: [paste full output/error — if the terminal was truly blank, say so explicitly]

Please help me troubleshoot and fix this error. You can use your general knowledge to solve the problem, but your solution MUST align with the architecture and tools taught in the attached file. Do not suggest alternative setups that contradict the tutorial. Once fixed, tell me what to do next in the article.

To go deeper on a step before you run a command:

I have attached the Part5.md file. Look at Step [X] and explain exactly what the command does and why we are doing it before I run it.

Think of this series as the roadmap and your AI assistant as your learning companion.

Prerequisites

Section 1 — Creating and Organizing Directories

Create nested directories in one command:

mkdir -p ~/project_1/data/raw
mkdir -p ~/project_1/data/processed
mkdir -p ~/project_1/scripts
mkdir -p ~/project_1/results

The -p flag creates all parent directories that don’t exist yet.

View your structure:

find ~/project_1 -type d

Section 2 — Managing Files

Beyond basic navigation, these tools are essential for file management:

Terminal Text Editors

Section 3 — File Permissions

Every file and folder in Linux has permissions controlling read, write, and execute access.

Run ls -l ~/project_1/ to see permissions. Change them with chmod:

Section 4 — Installing Software with apt

Use apt for system-level software, distinct from Python-level packages managed by conda or pip.

Section 5 — Environment Variables

Environment variables are configuration values bash reads at startup.

Section 6 — SSH: Connecting to Remote Machines

SSH lets you control remote machines from your terminal.

  1. Generate SSH key: ssh-keygen -t ed25519 -C "email@example.com"
  2. Connect: ssh username@server_address
  3. Copy key: ssh-copy-id username@server_address (enables password-less login)
  4. Transfer files: Use scp or rsync -avz for efficient directory synchronization

Section 7 — HPC Systems and SLURM

HPC clusters connect hundreds of computers to run massive jobs. Unlike local machines, you submit these jobs to a queue managed by a scheduler like SLURM.

A basic SLURM job script (job.sh):

#!/bin/bash
#SBATCH --job-name=my_job
#SBATCH --output=my_job_%j.out
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
#SBATCH --time=02:00:00

conda activate env_project1
python first_script.py

On HPC, use the module system to load software: module avail, module load python/3.11, module list.


What’s Next

What You’ve Done:

Further reading:

Next: Part 6 — Git and GitHub for Reproducible Research | Previous: Part 4 — Setting Up VS Code

All Blogs