Anoob Prakash
  • Home
  • Research
  • Notebook
  • Gallery
  • News
  • CV

On this page

  • Bash quick reference
  • R quick reference

Cheat sheet for everyday computational analysis

hpc
bash
slurm
Quick reference cheatsheet for frequently used commands for languages like bash, R, slurm etc.
Author

Anoob Prakash

Published

August 9, 2026

Bash quick reference

Command Purpose Example
~ Your home directory cd ~
/ Filesystem root and path separator cd /scratch
pwd Print working directory pwd
ls List files and directories ls -lh results
cd Change directory cd data/raw
cd .. Move up one directory cd ..
mkdir -p Create directory/directories mkdir -p logs results
head Show the beginning of a file head -n 5 file.txt
less View a file interactively; press q to exit less file.txt
grep Search for text in a file grep "value" file.txt
wc -l Count lines wc -l file.txt
curl -L -o Download URL into a named file curl -L -o file.txt URL

R quick reference

R basics

Function/operator Purpose Example
c() Combine values into a vector c(1, 2, 3)
<- Assignment x <- 5
read.delim() Read a tab-delimited file read.delim("data/raw/file.txt")
str() Show structure/types of an object str(df)
dim(), nrow(), ncol() Dimensions of a data frame dim(df)
head() / tail() First/last rows head(df, 5)
summary() Quick numeric/factor summary summary(df$Height)
df$col Access a column by name df$Fitness
df[rows, cols] Subset by position/condition df[df$Region == "E", ]
table() Count occurrences table(df$Population)
tapply() / aggregate() Grouped summaries tapply(df$Height, df$Population, mean)
function(...) {} Define a function f <- function(x) mean(x, na.rm = TRUE)
for (i in seq) Loop for (p in unique(df$Population)) {...}
hist(), boxplot(), plot() Base R plotting hist(df$Height)
write.csv() Save a table write.csv(x, "results/out.csv")

R for bioinformatics quick reference

Function/package Purpose Example
matrix() Build a genotype matrix matrix(..., nrow, ncol)
colMeans() Column-wise means (used for allele freq.) colMeans(geno) / 2
prcomp() Principal component analysis prcomp(geno, scale. = TRUE)
cor.test() Test correlation between two variables cor.test(x, y)
lm() Fit a linear model lm(y ~ x1 + x2, data = df)
vegan::rda() Redundancy analysis (multivariate GEA) rda(Y ~ x1 + x2, data = df)
vcfR::read.vcfR() Read a real VCF file (beyond this module) read.vcfR("file.vcf")
adegenet::genind Genotype container object (beyond this module) df2genind(...)
© · Anoob Prakash
  • Purdue

  • HTIRC