1: Introduction to Linux, Terminals & Shell Architecture
Chapter 1: Introduction to Linux, Terminals & Shell Architecture
Modern computational genomics is fundamentally built on Linux. High-throughput sequencers—such as Illumina NovaSeq X, Oxford Nanopore PromethION, and PacBio Revio—generate terabytes of raw sequencing reads per run. Graphical User Interfaces (GUIs) freeze and fail when attempting to process millions of read records. Linux provides the lightweight, scriptable, and highly parallel operating system environment necessary to analyze biological big data across workstations and supercomputing clusters.
The Unix design philosophy is built on two core principles: "Write programs that do one thing and do it well" and "Write programs to work together by streaming text." In genomics, tools like fastp, bwa-mem2, and samtools are chained together using Unix pipes, enabling gigabytes of sequence reads to flow through alignments without touching physical disks.
1. Linux Architecture: Kernel vs. Shell
A Linux system consists of four coordinated layers:
- Hardware: CPUs, memory (RAM), NVMe solid-state storage, and network interface cards.
- Linux Kernel: The core OS program that manages hardware resources, CPU scheduling, and memory allocation.
- The Shell (CLI): A command-line interpreter that reads text commands from the user, executes them via system calls, and prints output. The default standard shell across scientific computing is Bash (Bourne-Again Shell).
- User Applications: Compilers, interpreters (Python, R), and bioinformatics tool suites (SAMtools, BEDTools, BLAST+).
2. Connecting to Remote HPC Clusters via OpenSSH
Bioinformatics pipelines rarely run on personal laptops. Instead, researchers connect to institutional High-Performance Computing (HPC) clusters using the Secure Shell (ssh) protocol:
# 1. Connect to an institutional cluster with username and host
ssh username@hpc.genomics.edu
# 2. Connect specifying a custom port (e.g., 2222)
ssh -p 2222 username@cluster.omics.org
# 3. Generate a modern, highly secure Ed25519 SSH keypair
ssh-keygen -t ed25519 -C "researcher@omics.co.in"
# 4. Copy your public key to the remote server for passwordless authentication
ssh-copy-id -i ~/.ssh/id_ed25519.pub username@hpc.genomics.edu3. Anatomy of a Linux Command
Every command-line instruction follows a standard syntactic structure:
command [options/flags] [arguments]- Command: The executable program name (e.g.
ls,grep,samtools). - Options/Flags: Modify how the command behaves. Short options use a single hyphen (e.g.
-l,-a,-h, which can be combined into-lah). Long options use double hyphens (e.g.--all,--human-readable). - Arguments: The targets of the command, such as filenames, directories, or sequence strings.
4. Essential System Discovery Commands
Upon logging into any Linux machine or cluster compute node, inspect the execution environment with these foundational utilities:
# Who am I logged in as?
whoami
# What is the hostname of this machine/node?
hostname
# Inspect the Linux kernel version and CPU architecture (x86_64 vs aarch64)
uname -a
# How long has the machine been running and what is the current CPU load?
uptime
# Locate the exact binary path of an installed bioinformatics tool
which samtools
which bwa-mem2
# Check the exit status code of the last executed command (0 = Success, >0 = Error)
echo $?Common Pitfalls & Troubleshooting Checklist
- Java Heap Exhaustion (GATK / Picard): If processes terminate with
java.lang.OutOfMemoryError, set your environment variable explicitly:export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp". - Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with
samtools index -@ 4 sample.bam. - Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority:
conda config --set channel_priority strict. - Chromosome Naming Contamination: Always verify whether reference FASTA headers use
chr1or1; divergent naming causes silent alignment drops.