4 ms·
Recently, I have really wished for a "better terminal". Particularly as my number of processors go up, I want to be able to start a program in the background an
by CJefferson 15y ago
Recently, I have really wished for a "better terminal". Particularly as my number of processors go up, I want to be able to start a program in the background and not have it's output all over the screen. I've tried various solutions (redirect to temp file -- have to remember where it is, keep starting new tmux sessions, end up with too many windows most of which I don't want). I feel there should be something better. Personally, I take a GUI solution, where programs look more like a tree, and I can easily explore / close / duplicate branches.
- sliverstorm 15y agoHave you tried gnu screen? It isn't a gui interface, so you have to learn a few hotkeys, but it's one of the better options.
- runjake 15y agoHe mentioned tmux, which is very similar to Screen, so I suspect that wouldn't address his issues. http://tmux.sourceforge.net/ http://tmux.sourceforge.net/
- CJefferson 15y agotmux is similar to screen. I can keep opening hotkeys to open new windows to run commands in, but then I have to remember to go back to those windows to look at the results of those commands, etc. It doesn't really help me "maximise my processor usage" I find.
- eli 15y agoI believe iTerm2 on OS X hooks into tmux somehow to alert you when something has happened in one of your windows. I assume there's a way to make that happen on other platforms too.
- karlshea 15y agoUnfortunately last time I checked it was only for a branch of tmux. They are trying to get it into mainline but I don't think that has happened yet.
- sliverstorm 15y agoSo what you are saying is you want a more powerful version of regular shell background capabilities? You don't want output to interrupt your interactive session, but you don't want to have to remember to visit the output later. Do I have this right?
- CJefferson 15y agoI think so. I might not know what I want until I have it, or don't have it :) I just went through the following steps recently: 1) Put more things in the background with '&' - but if they have a lot of output they make your terminal usuable. 2) I could ' >t 2&>1 & ' , but then I have to remember to check t when the process finishes, and end up with lots of tiny files everywhere. 3) I could just send output to /dev/null , but then maybe I care what it was if the process fails.
- sliverstorm 15y agoPerhaps you could alias a function that pipes like tee, and checks for errors. Like this: alias myfunc "errorchecker >& /dev/null" [command] | myfunc What it does with those errors is up to you, though your main options are "print them" (in which case, just don't redirect stderr), "log them for fetching" (and write a little command to access & manage the failure reports), or "email them to yourself". I guess basically what I'm getting at is, look at distributed processing backends such as LSF or GRD for inspiration.
- natep 15y agoSounds like #2 could work if you had some sort of desktop notification system. Then you could write a small script that runs your command line with stdout and stderr redirected to temp file(s), and then alerts you when the process is done, and what the temp filenames are. You could check on your running jobs with 'ps -C scriptname' Or maybe opens them in $EDITOR...like this (I can't get it to work when $* has a pipe in it, unfortunately) #!/bin/bash out1=`tempfile -d $HOME/logs` out2=`tempfile -d $HOME/logs` $* >$out1 2>$out2 $EDITOR $out1 $out2 # Replace this with call to notification app and/or logic based on $?/size of $out2
- keeperofdakeys 15y agoTmux and screen have modes that allow you to 'watch' a window for activity, and alert you to this. They can even watch for inactivity, and warn you when something finishes. You can also use "echo ^v^g" (where ^ is ctrl) to summon a bell, tmux and screen can be configured to alert you to such a bell.
- gav 15y agoI generally use nohup so I don't have to worry about killing the program when I log out. The man page has a handy bash script for "launch" that captures stdout and stderr to separate files. http://ss64.com/bash/nohup.html http://ss64.com/bash/nohup.html
- wahnfrieden 15y agoNot a general solution for your problem, but you could use GNU parallel anytime you'd use xargs (they use the same API).
- icebraining 15y agoWhy not just open a new terminal?
- eevee 15y agoHave you tried tmux's window monitoring settings? tmux can beep you when a window becomes active, goes silent, or prints a particular string—which will presumably make your terminal emulator yell at you somehow, too.