0

Is there a shell command to show the output of n given commands in parallel? I have n log-view commands (where n can be different at the startup time) and I like to show their output in parallel.

It should look like the split view of tmux, but with tmux it seems to be really hard to just give n commands and get a uniform split output view of them.

The call should be something like (the given commands are probably useless; they are just an example): split_command_view "watch -n0.1 ls -la" "tail -F log.txt" "date"

In this case the screen should be split in three sub-terminals and show the commands outputs.

Does something like this exist?

Thank you

1

multitail is such a command:

multitail -l cmd1 -l cmd2

Or if you want the windows to persist after the commands have finished:

multitail -l 'cmd1; sleep inf' -l 'cmd2; sleep inf'

(if your sleep doesn't support inf, you can change it to a very large integer instead).

0

tail supports displaying mutiple files at once, however it doesn't split the terminal into panes like tmux does.

tail -f /var/log/syslog /var/log/auth.log

  • I use kubectl to show the log of a remote cluster, therefore I think, I cannot use tail. – Kevin Meier Mar 4 at 9:16
0

The way to do that is to output the proc to a different TTY. To know the name of your current tty just type tty. It will give you for example /dev/pts/0. Then you can run commands like

tail -f /permanent.log > /dev/pts/0 &

With the & at the end you send the proc to the background so you can run more commands. To recover the proc, you can use the jobs and fg commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.