Skip to content

Useful Linux bash commands

Konstantinos Tsilimparis edited this page Mar 13, 2026 · 5 revisions

General

# Start interactive bash (srun = interactive, sbatch = batch job)

## Method 1
srun --mem=4G --cpus-per-task=2 --time=71:00:00 --pty bash

## Method 2
sbash --mem=32GB --cpus-per-task=2 --time=10:00:00


# Check jobs in queue
squeue --me

# Check cores, mem, time left of your job
squeue -j  <job_id> -o " %.4C %.10m %L"

# Cancel job
scancel <job_id>

# Hostname of node running Jupyter

## Method 1
import socket
socket.gethostname()

## Method 2
!hostname

Login Node

# Watch live RAM
watch -n 1 "cat /sys/fs/cgroup/user.slice/user-$(id -u).slice/memory.current"

# Check max memory
cat /sys/fs/cgroup/user.slice/user-$(id -u).slice/memory.max

# Last 50 errors (e.g., Pylance/Jupyter crashes)
dmesg | tail -50

Stijn's jupyter guide

# Submit Jupyter job
sbatch jupyter_ptk-dev.sh

# Watch Jupyter job output (Replace job id)
watch -n 1 cat jupyter-<job_id>.out

Clone this wiki locally