Linux Command-Line Basics
CUNY HPCC uses Linux-based systems, primarily accessed through SSH. Most researchers only need a few basic Linux commands to navigate directories, manage files, and prepare computational jobs.
Essential Linux Commands
| Command | Description |
|---|---|
pwd |
Display your current directory |
ls |
List files and directories |
ls -lah |
List files with detailed information, including hidden files |
cd <directory> |
Change directories |
cd .. |
Move up one directory |
cd ~ |
Return to your home directory |
mkdir <name> |
Create a directory |
cp <source> <destination> |
Copy a file |
mv <source> <destination> |
Move or rename a file |
rm <file> |
Delete a file |
rm -r <directory> |
Delete a directory and its contents |
cat <file> |
Display file contents |
nano <file> |
Edit a text file (if Nano is installed) |
less <file> |
View a file interactively |
du -sh <directory> |
Display directory size |
chmod |
Modify file permissions |
man <command> |
Display a command's manual |
Warning: Files deleted using rm generally cannot be recovered. Always verify file paths before deleting research data.
Basic Example
# Create a directory
mkdir my_project
# Enter the directory
cd my_project
# Create a file
echo "Hello CUNY HPCC!" > hello.txt
# note the previous command utilized the output redirection operator '>'
# Display the file
cat hello.txt
# Copy the file
cp hello.txt backup.txt
# List files
ls -lh
Software and Environment Modules
CUNY HPCC provides scientific software through environment modules.
module avail # List available modules
module spider python # Search for Python modules
module load <module> # Load a software module
module list # Show loaded modules
module unload <module> # Unload a module
See more at the Software Modules with Lmod page.
Running Computational Jobs
Do not run computationally intensive workloads directly on login nodes. Submit them through Slurm instead.
sbatch job.sh # Submit a job
squeue -u "$USER" # Check your jobs
scancel <job-id> # Cancel a job
sinfo # View cluster partitions
For more information about resource allocation and submitting jobs, see the Running Jobs section.