Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
|
Download web_docs/docs/guides/terminal-corruption-fix.md from CommunityOne/open-navigator: direct link, hf CLI and curl.
- Browser
- Download file 2.18 kB
-
https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_docs/docs/guides/terminal-corruption-fix.md
- Command line
-
hf download hf://spaces/CommunityOne/open-navigator/web_docs/docs/guides/terminal-corruption-fix.md
-
curl -L -o terminal-corruption-fix.md https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_docs/docs/guides/terminal-corruption-fix.md
2.18 kB
metadata
title: Terminal Corruption Fix
Terminal Corruption Prevention Guide
What Happened
Terminal pagers (like less, more) use an "alternate screen buffer" that can get corrupted, causing command output to be written as files in your current directory. This is compounded when you're in the wrong directory (like frontend/).
Symptoms
Random files appearing with names like:
= f.readlines()245 fluoride bills across all 50 states (was only 5 states)lativesession s ON b.legislative_session_id = s.id
These are fragments of command output or SQL queries.
Immediate Fix
1. Clean up garbage files:
bash scripts/cleanup_frontend_junk.sh
2. Reset your terminal:
reset
cd /home/developer/projects/open-navigator
Prevention (CRITICAL)
Add to your ~/.bashrc or ~/.zshrc:
# Prevent pager corruption
export PAGER=cat
export GIT_PAGER=cat
export PSQL_PAGER=
export SYSTEMD_PAGER=cat
# Git config
git config --global core.pager cat
Then reload your shell:
source ~/.bashrc # or source ~/.zshrc
Best Practices
- Always check your working directory:
pwd # Before running commands
- Run commands from project root:
cd /home/developer/projects/open-navigator
# NOT from frontend/, api/, etc.
- Use
--no-pagerflags:
git log --no-pager
psql --no-pager
- If terminal gets corrupted:
reset && stty sane
Updated Files
- Yes
frontend/.gitignore- Ignores garbage files - Yes
scripts/cleanup_frontend_junk.sh- Cleanup script - Yes
scripts/prevent_terminal_corruption.sh- Prevention config
Why This Happens
- Alternate screen buffer - Commands like
less,more,git log,psqloutput - Terminal state corruption - Buffer doesn't close properly
- Wrong working directory - Your psql terminal had
cwd: frontend/ - Output redirection - Corrupted state writes output as files
Never Again
Run this once:
source scripts/prevent_terminal_corruption.sh
Add to your shell profile permanently:
echo 'export PAGER=cat' >> ~/.bashrc