The `2>&1` syntax means "redirect file descriptor 2 (stderr) to wherever file descriptor 1 (stdout) is going."
**Separate files for stdout and stderr:**
```shell-session
$python train.py > results.txt 2> errors.txt
```
**Discard output entirely:**
```shell-session
$command> /dev/null 2>&1 # Discard everything
$command 2> /dev/null # Discard only errors
```
{{% alert title="Why this matters for HPC" color="info" %}}
Slurm jobs capture stdout and stderr to files. Understanding redirection helps you:
- Debug failed jobs by checking error output
- Keep logs clean by separating normal output from errors
- Combine outputs when needed with `2>&1`
{{% /alert %}}
### Exercise 2: Build your own structure
Create a directory structure for a different project:
@@ -450,68 +493,7 @@ $ grep -l "import" src/*.py # Just show filenames
The `find . -mtime -1` command should list files you recently created. The `grep -n` command shows line numbers where "print" appears. The directory search should show `./data` (and any other data directories you created).
{{% /alert %}}
## Part 7: Transferring files
You'll often need to move data between your local computer and DAIC.