How do I mirror (synchronize) panels in tmux? - tmux

I'd like that whatever I do on a panel to be copied on other panels simultaneously.
For example, I'd like to ssh to multiple similar servers and execute identical tasks in all of them simultaneously.

If by panels you mean panes, doing
<prefix> :setw synchronize-panes on
will enable the feature you want.
If you want to turn it off after you are done doing what you want,
<prefix> :setw synchronize-panes off

Related

What keystroke can you use to select a specific window within a tmux session?

In tmux, you can launch the visual layout for selecting a session/window with Ctrl+b s (C-b s).
You can then switch to the last opened window in any of the available sessions by typing the number beside that session.
When you highlight a session with multiple windows, tmux shows a split with the contents of each window. It also shows numbers over those splits which I presume are for selecting those windows (see image). However, when I type one of those numbers, I am instead brought to a window from among the available sessions. What keys can you use to select a window within a session?
Note, I am aware that I can launch the choose-tree command with C-b w with all windows expanded, but for now I prefer launching the layout showing only sessions.
Tmux layout with multiple windows in a session

Make tmux only monitor activity on status return

Is there a way to make tmux only show an activity alert once a process has returned?
Assuming you have activity monitoring activated, the way it works by default is to alert you whenever anything in the window changes. This is essentially useless (and incredibly annoying) if you are running any long-running process that spits out progress or any other kind of output along the way.
Suggesting that I run these commands with --quiet or the like is NOT what I'm looking for. In a lot of cases, I want to be able to check up on them (not to mention, know that they haven't crashed).
I'm not too hopeful here since I've read through the docs and the options for activity monitoring are pretty slim. Does anyone know some other hack to make this work??
I'am also trying to do the same thing. The options monitor-content and monitor-silence may be helpful.
If a process keeps printing something on the window, use monitor-silence to monitor long silence.
setw -g monitor-silence INTERVAL
A window would be highlighted if it has been silent for INTERVAL seconds.
If a process never prints anything, or prints only several times in a very long period, use monitor-content to monitor a specified content. For example
setw -g monitor-content 'Process exited'
Then run your command in this way
clear; YOUR_COMMAND; echo 'Process exited'
Not a perfect solution, but works for me in most cases.

Copying text into minicom doesn't get pasted completely

I am trying to paste a line; which is:
setenv -p STARTUP "ifconfig eth0 -auto;boot -z -elf 136.170.195.87:vmlinuz-nfs-7231b0-D183-NFS-DEBUG 'root=/dev/nfs nfsroot=136.170.195.87:/export/home/joshis1/vmlinuz-nfs-7231b0-D183/rootfs/nfs rw bmem=226M#30M ip=dhcp'"
When I try to copy the line in minicom, the line is not copied completely.
What should I do?
I have solved this by setting Character tx delay to 1ms.
Ctrl+A followed by z
select 't'
select 'f'
type '1'
and there you go!
Maybe you are running without line wrap on? I had a problem until I started invoking with "minicom -w". In the problem condition, output line content beyond screen width was lost, input line content wrapped to beginning of line.
If I'm not wrong you should exit minicom, start it again with "minicom -w".
Or even better, try using 'screen' instead of 'minicom'. I gave up minicom a long time ago in favor of screen. Once you get used to it, you'll never go back!. Chris Stratton was probably right: you're overrunning the target. There is no flow control in virtually all embedded targets. That said, I do these copy operations from screen all the time using screen to set u-boot environment variables, and never have any issues. Depends on your target, too!
Invoke screen something like this:
screen /dev/ttyUSB0 115200
Of course, the device node corresponding to your serial port will be different depending on your serial device. The example above is typical for Linux with a USB serial dongle. On my macbook, it usually comes up as something like this for the same serial dongle:
/dev/tty.usbserial
If you like vi, you'll love screen.
I do like the suggestion of this answer to use screen.
However, if you want to keep using minicom an option is to enable both Software flow control and Line wrap.
To enable Software flow control:
press Ctrl+A followed by o
go down to Serial port setup and enter it
press g to switch Software Flow Control to Yes (if not previously enabled)
press Esc and select Save setup as dfl if you want to permanently save the configuration
To enable Line wrap:
press Ctrl+A followed by o
go down to Screen and keyboard and enter it
press r to switch Line Wrap to Yes (if not previously enabled)
press Esc and select Save setup as dfl if you want to permanently save the configuration
Line wrapping can also be enabled by starting minicom with the -w option or by pressing Ctrl+A followed by w.

How can I reverse the history numbering?

I am a unix addict, and many of the machines I use (at home and at work) are now quickly passing the 10,000 command mark. I like to keep all of the commands I issue readily available which is why I have set the upper limit to something like 100,000 entries, but it is becoming tedious to recall particular recent entries as I have to be writing !12524 in the shell to expand out that one.
Sure, I can use the shortcut ones to recall the last command or even the tenth-last command but its impossible to keep track of that so 90% of the time I am doing things like history | grep 'configure --prefix' (for reviewing how I configured something last, etc) and then using whatever history index that spits back.
Can I reverse it so that command #10000 corresponds to the command from ten thousand commands ago, and have command #1 be the last command?

What is the meaning of "t" in ls output?

ls reports the following:
# ls -ld /var/lib/puppet/state/
drwxr-xr-t 3 puppet puppet 4096 Jan 8 16:53 /var/lib/puppet/state/
What does the "t" mean for other? What tool reports the symbolic names for the permissions? ls has the --numeric-uid-gid option, but is there another one for permissions?
man ls is your friend:
t The sticky bit is set (mode 1000), and is searchable or executable.
(See chmod(1) or sticky(8).)
About sticky bit:
When set, it instructed the operating system to retain the text segment of the program in swap space after the process exited. This speeds up subsequent executions by allowing the kernel to make a single operation of moving the program from swap to real memory. Thus, frequently-used programs like editors would load noticeably faster.
The sticky bit is today incredibly confusing. It no longer pins the file into memory, making it actually "sticky", anymore. Sometimes it is called the "tacky" bit because it is represented as a 't' or 'T', but other folks still call it sticky. It only matters in modern linux and unix when applied to a directory, as far as I can tell. It means that people in groups who have the permission to delete a file still can't do it if the sticky bit is set on the directory. But it gets more confusing. It shows up in the last field, which is the execute/search field for "other" users, but acts on "group" users ("other" normal users can never delete files). The reason why it isn't shown in the "group" execute field is because that one changes to an "s" if the SETUID bit is set for group. I think. I am still researching that one.

Resources