Shell Access and Command-Line Computing
Last updated on 2026-08-27 | Edit this page
Overview
Questions
- How do you access the command line through OnDemand?
- What is a Web Terminal session?
- How do you manage multiple terminal sessions?
- What commands are available in OnDemand shell access?
Objectives
- Launch and use the Web Terminal from OnDemand
- Execute HPC commands without SSH
- Manage multiple concurrent terminal sessions
- Navigate the file system and manage resources using shell
- Understand limitations and best practices for web-based terminals
Web Terminal Access
The Web Terminal in OnDemand provides a full command-line shell through your browser, eliminating the need to install SSH clients or learn command-line interfaces. It connects to a login node on Sagehen.
Important: Login vs. Compute Nodes
The Web Terminal connects to a login node, designed for small, quick tasks like editing files and submitting jobs. For intensive computations, submit SLURM jobs instead. Running computationally heavy tasks on the login node can affect other users.
Launching the Web Terminal
Method 1: Through Interactive Apps
- Open OnDemand at https://ondemand.hpc.pomona.edu/
- Navigate to “Interactive Apps” menu (left sidebar)
- Find and click “Web Terminal” or “Shell Access”
- Click “Launch”
- After a brief loading period, a terminal window opens in your browser
Using the Web Terminal
Basic Operations
The Web Terminal behaves like a standard Linux terminal. You can execute standard commands for:
- Checking your current directory: pwd
- Listing files: ls, ls -la
- Changing directories: cd
/rhome/<myusername> - Viewing file contents: cat, head
- Creating directories: mkdir
- Copying and moving files: cp, mv
Text Editing
You can use command-line editors from the web terminal:
- Nano: A beginner-friendly editor (Ctrl+X to exit)
- Vim: An advanced editor (:wq to save)
- Default editor: edit command for text files
Job Submission
Submit SLURM jobs directly from the terminal with sbatch. View job status with squeue. Cancel jobs with scancel. Check cluster information with sinfo.
A typical job script includes:
#!/bin/bash
#SBATCH --job-name=MyJob
#SBATCH --partition=normal
#SBATCH --nodes=1
#SBATCH --time=01:00:00
#SBATCH --output=job.log
echo "Starting job at $(date)"
sleep 30
echo "Job complete"
Multiple Terminal Sessions
Opening Multiple Terminals
You can open multiple terminal windows simultaneously through OnDemand. Each terminal is independent and can run different tasks. Use multiple terminals to monitor jobs while editing code, or to run multiple processes in parallel.
Browser tabs help organize your work:
- Rename tabs to identify their purpose
- Switch between tabs with mouse or keyboard shortcuts
- Closing a tab closes that terminal session
File Operations in the Terminal
Working with Data
Standard Linux commands work for file operations:
- wc -l: Count lines in files
- grep: Search for patterns in text
- sort and uniq: Organize data
- tar and gzip: Compress and archive files
- File manipulation: ls, cp, mv, rm, etc.
Monitoring and Resource Management
Terminal Limitations and Considerations
The Web Terminal has some important limitations:
- Interactive programs may have limited support
- Can only connect to systems accessible from Sagehen
- Long-idle sessions may disconnect
- Copy-paste works with Ctrl+C/Ctrl+V
- Personal SSH keys are available for other systems
Best Practices for Web Terminal
- Don’t leave idle terminals open; close ones you’re not actively using
- Use screen or tmux for long-running processes that survive disconnections
- Save work frequently in case of unexpected disconnections
- Write temporary files to /scratch, not /rhome
- Monitor resources with squeue before launching new jobs
- Cancel idle jobs with scancel to free resources
Pro Tip: Use screen or tmux
For long-running processes, use screen or
tmux to create persistent sessions that survive browser
disconnections. Start your process inside a screen session, then detach
with Ctrl+A+D. Reconnect later even after closing your terminal.
Troubleshooting Terminal Issues
- Slow performance: Try a different browser or check network
- Copy-paste issues: Try Ctrl+Shift+C/Ctrl+Shift+V
- Disconnections: Open new terminal and check squeue for jobs
- Command not found: Load required module with module load
- Permission denied: Check file permissions with ls -l
Challenge: Command-Line Computing
Use the Web Terminal to complete these tasks:
- Navigate to your /rhome directory and list all files
- Create a new directory called “my_analysis”
- Create a simple Python script that prints “Hello from Sagehen!”
- Run the Python script from the terminal
- Check the current status of the Sagehen HPC cluster with sinfo
- View any jobs you have running with squeue -u $USER
Record what you observe, especially:
- How many nodes are in the cluster?
- What partitions are available?
- Are you currently running any jobs?
After completing this challenge:
- Your /rhome directory contains configuration files and personal data
- The new directory appears in listings with mkdir
- Your Python script executes successfully, printing the output
- sinfo shows the cluster composition with nodes in various partitions
- squeue -u $USER shows your jobs if running, or an empty table
- You see partition information and node status
Common observations:
- Most nodes are idle or allocated during normal times
- Jobs have IDs starting from recent numbers
- Python/Python3 is available without module loading
- The terminal responds quickly to most commands
- Complex file operations work just like SSH access
- Cluster status changes throughout the day as jobs complete
Accessing Sagehen HPC via SSH (Alternative)
While the Web Terminal is convenient, some users prefer SSH for direct access:
ssh <myusername>@sagehen.hpc.pomona.edu
ssh -i ~/.ssh/id_rsa <myusername>@sagehen.hpc.pomona.edu
SSH provides the same shell access but requires pre-configured authentication on your local computer.
- Web Terminal provides full command-line access through your browser
- Launch from Interactive Apps or Clusters menu in OnDemand
- Run standard Linux commands, submit SLURM jobs, and manage files
- Multiple terminal sessions can run independently for parallel work
- Use screen/tmux for long-running processes that survive disconnections
- Web Terminal is convenient for beginners; SSH is available for advanced users