Back to Blog
Proxmox
SSH
Linux
Shell
Productivity
Don't Forget Your Running Sessions: A Quick Shell Hack for Proxmox and SSH Users
December 21, 2025
6 min read read
If you've spent any amount of time working on remote systems via SSH, you know the drill: open a session, get deep into some task—maybe you're updating a virtual machine, migrating containers, or running a script that takes just a bit longer than expected—then you get pulled away. Later, maybe much later, you reconnect… and realize that screen session from earlier? Still running. Maybe detached, maybe not. But definitely forgotten.
That's exactly the low-key frustration one user set out to solve with a simple .bashrc trick, and honestly, it's the kind of quality-of-life improvement that deserves a little more spotlight.
## One Line to Rule Your Sessions
Here's the tip that kicked off the conversation:
Add this to your `.bashrc` file:
```bash
screen -ls | grep -e Attached -e Detached
```
What does it do? Every time you start a new terminal session—SSH into your Proxmox box, for example—you get an immediate heads-up if there are existing screen sessions running. It checks both attached and detached sessions, essentially pinging you with a reminder that you might have left something open.
It's not flashy, but it works. And when you're juggling multiple remote tasks or running long operations that you really don't want to interrupt, that reminder can save you a bunch of headaches.
## Why It Matters
To the uninitiated, it might seem trivial. "So what if a screen session is left running?" one commenter asked. Fair question. After all, screen (and its cousin tmux) are designed to let you leave sessions running in the background—even after your SSH connection drops.
But here's the thing: the problem isn't that sessions are left running. The problem is forgetting that they're running.
One user summed it up best:
> "I get sidetracked sometimes while doing a job in the shell at work. I've done large VM/CT transfers over SSH and use screen in case the session fails… as an example."
If you forget that a long operation is still running, or worse, if you start a conflicting task in a new session without realizing it, you could be in for a bad time—data loss, process duplication, or simply lost productivity. A quick reminder on login? It's just smart.
## Tmux Users, You're Covered Too
Not using screen? No problem—tmux fans chimed in fast. One popular alternative offered was this slick line for `.bashrc`:
```bash
tmux new -A -s main
```
Translation: if a tmux session named "main" exists, attach to it. If it doesn't, create it. It's a clean way to automatically jump back into your workspace without fumbling through `tmux ls` or guessing session names.
For those who like aliases, another user threw in this gem:
```bash
alias t='tmux a || tmux'
```
Here, `t` will try to attach to the most recent session. If there isn't one, it starts a new one. Simple. Clean. Effective.
## The Real Win: Mental Clarity
None of these shell tweaks are revolutionary, and that's exactly the point. They're dead simple, easy to adopt, and help clear out one more little mental trap in a workflow that's already overloaded with complexity.
Proxmox users, in particular, are often dealing with multiple layers of abstraction—VMs, containers, network configurations, backups, storage—and one wrong move can ripple outward. Forgetting a running shell session may not cause a disaster, but it's a small crack in the process that's just waiting to widen.
These tweaks act like sticky notes for your terminal. And if you're hopping between multiple Proxmox nodes or environments via SSH, those little reminders can help you stay grounded.
## But... Is Leaving Sessions Really That Bad?
Some pushback in the community was inevitable. "Why does it matter if you leave a session running?" one user asked, pointing out that resource usage is tiny, and persistence is kind of the whole point of tools like screen.
They're not wrong. If your workflow involves leaving sessions up for hours—or even days—without issue, and you're good at managing them mentally, more power to you. But even in those cases, it's nice to know what's running, especially if you're on shared hardware or managing sensitive tasks.
And frankly, some of us are human. We forget. We leave stuff running when we shouldn't. We close laptops in a hurry, walk into meetings, or get hit with random internet drops. It's not about paranoia—it's about control.
## Going One Step Further: .bash_logout
Another user had a different take: instead of checking on login, why not remind yourself on logout? Enter the `~/.bash_logout` file. You can drop similar commands there to prompt a final check before you exit your shell:
```bash
screen -ls | grep Detached
```
Now you're being nudged on your way out too. It's like your terminal whispering, "Hey, don't forget you left something running." Nice touch.
## Is This Overkill? Maybe. But Also... Not Really.
In a world of cron jobs, Ansible playbooks, and GPU-passthrough configs that make your head spin, this tip feels almost laughably quaint. One command. No dependencies. No install scripts. Just your shell doing a tiny bit more to help you stay sharp.
It's the digital equivalent of putting your keys in the same place every day. Maybe you never lose them—but why not reduce the odds?
## Final Thought: Respect the Quiet Fixes
There's a temptation to ignore little workflow optimizations like this. They don't feel urgent. They're not flashy. But they add up. Like linting your code. Or naming your servers consistently. Or documenting just enough.
This `.bashrc` tweak won't change the world. But it might save you from rebooting a stuck VM because you forgot a transfer was still running in a detached session. It might save you from chasing down log files after you accidentally killed a background task.
And that? That's worth a line in your `.bashrc`.
Keep Exploring
Blackwell Meets Proxmox: When 'Open' Nvidia Drivers Still Refuse to Load
Nvidia's new Blackwell GPUs and their 'open' kernel modules should make Linux life easier. But Proxmox 9.1 users are hitting a frustrating wall where drivers compile fine but refuse to load—and the usual fixes don't help.
Proxmox, Power Failures, and the One Time initramfs Quietly Ruined My Week
A power outage turned into a week-long debugging session when initramfs refused to mount the root filesystem. Here's what went wrong and how to fix it.
RDP into Linux Like a Pro: How Beginners Are Ditching Windows for Debian, Ubuntu, and More
Discover how beginners are successfully switching from Windows to Linux in their home labs by setting up RDP access on Debian, Ubuntu, and other distros—making remote desktop as smooth as Windows without the resource drain.
BTRFS Inside Proxmox VMs: Smart Flexibility or a CoW-on-CoW Trap Waiting to Happen?
Using BTRFS inside Proxmox VMs can be great for snapshots and subvolumes, but stacking CoW on CoW (especially on ZFS hosts) can introduce serious IO overhead and fragmentation risks.