this post was submitted on 09 May 2026
43 points (100.0% liked)

Linux

65121 readers
501 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS
 

I need to be able to launch a program in the background, make it persist after the "parent" terminal closes and be able to access its stdin/stdout from another terminal. I don't care about multiplexing.

I've been using tmux for this but I don't like how it hijacks my mouse and that i'm not able to use my terminal's search feature and have to use what tmux tui provides instead. In other words, programs launched directly in the terminal feel more comfortable to work with than when they are launched inside tmux.

I feel the ideal program should behave much simpler. Like e.g. on attach it should clear the screen, print the stdout buffer it accumulated and give me stdin prompt, that's it.

top 10 comments
sorted by: hot top controversial new old
[–] SlicedPotato@feddit.dk 24 points 19 hours ago

Have you tried screen? AFAIK it's similar to tmux, but tmux has more bells and whistles, which it sounds like you want to avoid. I use it sometimes to start long running rsync sessions on a server and then periodically SSH in and check it. It does break scrolling though, but I don't know if there's some option to make it behave more like a normal terminal.

[–] haxboar@hexbear.net 8 points 16 hours ago* (last edited 16 hours ago)

Maybe I'm misunderstanding what your requirements are, but screen may be what you need https://www.man7.org/linux/man-pages/man1/screen.1.html

You might also be able to background the process:

https://linuxize.com/post/how-to-run-linux-commands-in-background/

[–] ninex@safest.space 18 points 20 hours ago (1 children)
[–] folekaule@lemmy.world 14 points 19 hours ago

Yep. That is the simplest answer. From the link, directing stdout and stderr to a file:

nohup mycommand > mycommand.out 2>&1 &

GNU Screen is an alternative.

You can also use tmux and just disable the mouse by adding this to ~/.tmux.conf

set -g mouse off
[–] whatiswrongwithyou@lemmy.ml 7 points 17 hours ago

You have a bunch of answers including one you chose, but you can always rebind the tmux key to something compatible with your terminals search and use [key] - d to disconnect from your tmux session then invoke it with tmux attach-session to get back into your session.

on attach it should clear the screen, print the stdout buffer it accumulated and give me stdin prompt, that’s it

The last part of the above, disconnecting from tmux and reattaching would do what you described. That may be useful if you need to work with tmux.

[–] hades@feddit.uk 13 points 20 hours ago (1 children)
[–] gera@feddit.nu 4 points 19 hours ago

Looks like what I wanted, thanks! Took me a bit to figure out how to write an openrc service for its daemon but now it works

[–] fitgse@sh.itjust.works 5 points 17 hours ago

You could also create a user systemd service. It’s just a few line config you drop into the correct place in your home directory.

https://wiki.archlinux.org/title/Systemd/User

[–] MasterOKhan@lemmy.ca 3 points 19 hours ago

Might not be exactly what you want but I sometimes use mosh for this reason, I can start a task in the mosh terminal and then minimize or sleep, or even hibernate the machine and I will be able to come back to the same session later. (It also continues running if the connection is lost, and will reconnect when able)

[–] rImITywR@lemmy.world 1 points 20 hours ago

Run the background stuff as a daemon, and then write an interface to take stdin/stdout and interact with that daemon.