tmux: show output of all the sessions last 15 lines - tmux

I have 5 tmux sessions running. Each session has only one window.
I want to see the output of all the sessions windows last 10 lines
How can i see.

Related

Can the number of sleeping task in the current window be shown in Tmux statusbar?

I often use ^Z to make sleep a process, possibly open a new one, make this one sleep too, and so on, also moving between different Tmux windows.
So what I would like, is that the Tmux status bar update relevantly to indicate me how many processes are sleeping in the currently focused window.
Is that possible?
This is a common question - how to pass information from a shell inside tmux to tmux. The easiest way to do this is to have your shell do it as part of PS1 or some other variable that is evaluated when the prompt is printed.
There are two things you can do:
1) Set a user option with tmux set -w #myoption xyz, then you can use it in the status line with #{#myoption}. This has the disadvantage that it cannot work over ssh.
2) Set the pane title using the escape sequence, for example: printf "\033]2;xyz\033\\". It is then available in #{pane_title}. This works over ssh but had the disadvantage that there is no way to prevent applications also changing the title if they want.
In either case you will only want to run this when TMUX is set, so something like:
[ -n "$TMUX" ] && tmux set -w #myoption $(jobs|wc -l)

zsh clears previous line of prompt

I have a multi-line prompt in zsh. I've found that sometimes when I CTRL-C out of an autocompletion the previous line of the prompt gets erased unexpectedly. Here's a gif showing this happening with ls, vim and fzf: http://imgur.com/1jTrrzA
Here's an outline of events that happen:
ls all the files
ls then tab complete and CTRL-C out of the first completion (previous line of prompt gets erased)
ls then tab complete and CTRL-C out of the second completion. The previous line of the prompt doesn't get erased
same as step 2 but with vim instead
same as step 3 but I hit Enter instead of CTRL-C, this is my mistake. However, if I CTRL-C out of this example (the not-first completion) the previous line isn't erased
Show how fzf suffers from the same problem several times
I've found that the issue as shown during step 2 and step 4 still exists with a single line prompt. However fzf isn't broken with a single line prompt.
My entire prompt can be found at http://pastebin.com/JwufRy6m which is a modified version of https://github.com/sorin-ionescu/prezto/blob/master/modules/prompt/functions/prompt_sorin_setup to work with mercurial repositories at my company. The lines of interest (I think) in my prompt file are 166 and 167 (line 167 == line 166 minus $prompt_newline).
I've tried creating a multiline prompt without using $prompt_newline by doing:
NEWLINE=$'\n'
PROMPT=.....${NEWLINE}....
But that didn't help either which kinda makes sense to me because part of the problem still exists with single-line prompts.

Accessing different panes inside the same window on separate sessions

I have iTerm2 running with two horizontal splits, split_A and split_B.
I am attached to the same tmux sessions in split_A and in split_B.
I have one window running in the tmux session, with 2 panes, pane_A and pane_B
When I do next-pane in one of the splits, the tmux running in the other split does exactly the same and moves to the next pane. So the tmux sessions are synced.
Is there a way to display pane_A in one of the tmux sessions and pane_B in the other.
Just to make sure: pane_A and pane_B are running in the same window and same session.
|-----------------------------------|
||---------------------------------||
|| iterm2 split, tmux:windowA:1 ||
||---------------------------------||
|| iterm2 split, tmux:windowA:0 ||
||---------------------------------||
|-----------------------------------|
Just because panes do not have names, so I would like to have the top tmux names console and the bottom files and their session called DEV.
DEV > CONSOLE (top split)
DEV > FILES (bottom split)
Apologies for the horrible ASCII art.
Thinking about the goal of tmux, I believe there is no way to do what your described. In addition, it seems to me that in this case you can go with one iterm window + two tmux panes, simple and easy. Why you split iterm in the first place?

Kill fbi frame buffer process, after x time

I have a problem with a sh script.
I am using a raspberry, and want in my script to display with fbi frame buffer an image for 10 seconds. After these 10 seconds I want my script to run other sequential commands.
I wrote:
[...]
if[...]
fbi --noverbose $MEDIAFILE
MYPID=pgrep fbi
echo "[$MYPID] this is MY PID - and now i kill it!!!"
[...]
but my script stops itself in the first line (fbi --noverbose...) and I can't kill it in the next line :(.
I can't execute the command in background because I need to see the image...
any idea? thank you!
If your goal is to not show anymore after a certain amount of seconds, you can also add the command line options "-t secs" and "-1". "-t secs" is used for slideshows and is the time after which the next image is shown and "-1" means that the slideshow wont loop.
In your case:
fbi --noverbose -t 10 -1 $MEDIAFILE
This shows the image for ten seconds and then the fbi command finishes. No need to kill the process.
If fbi can't be run in the background, put your kill command in the background. To make it happen after a delay, use a subshell that sleeps first, then runs the kill command. The script would look something like this:
( sleep 10 ; kill $(pgrep fbi) ) &
fbi somefile

viewing the updated data in a file

If i have file for eg: a log file created by any background process on unix,
how do i view the data that getting updated each and every time.
i know that i can use tail command to see the file.but let's say i have used
tail -10 file.txt it will give the last 10 lines.but if lets say at one time 10 lines got added and at the next instance it has been added 2 lines. now from the tail command i can see previous 8 lines also.i don't want this.i want only those two lines which were added.
In short i want to view only those lines which were appended.how can i do this?
tail -f file.txt
That always outputs the last added lines immediately.

Resources