The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,679 other followers

Archive for the ‘tmux’ Category

Reptyr – Forgot to “screen” your ssh session first, and now that long running…

Posted by jpluimers on 2018/12/24

From a while back, but still so cool! It allows you to “recover” the terminal (stdin/stdout/stderr) of a process that was attached to a terminal or ssh session.

Reptyr – Forgot to “screen” your ssh session first, and now that long running thing is stuck?

»reptyr PID will grab the process with id PID and attach it to your current terminal.«

server:~ # zypper install reptyr
...
Retrieving: reptyr-0.3dev_git20120325-7.1.2.x86_64.rpm ...................[done]
(1/1) Installing: reptyr-0.3dev_git20120325-7.1.2 ........................[done]
server:~ # rpm -qi reptyr
...
Summary     : A tool for "re-ptying" programs
Description :
reptyr is a utility for taking an existing running program and
attaching it to a new terminal. Started a long-running process over
ssh, but have to leave and don't want to interrupt it? Just start a
screen, use reptyr to grab it, and then kill the ssh session and head
on home.
Distribution: openSUSE 13.1

Source: [WayBack] Reptyr – Forgot to “screen” your ssh session first, and now that long running thing is stuck?… – Kristian Köhntopp – Google+

It works with tmux too and is supported on many Linux distributions, see for instance [WayBackReptyr – Move A Running Process From One Terminal To Another Without Closing It – OSTechNix.

You can even redirect a pty for gdb usage: [WayBackreptyr(1): new terminal – Linux man page

StackExchange thread: [WayBack] How to recover a shell after a disconnection with these entries:

Originally from 2011 [WayBackreptyr: Attach a running process to a new terminal – Made of Bugs it is still maintained:

GitHub repository [WayBacknelhage/reptyr: Reparent a running program to a new terminal

–jeroen

Posted in *nix, *nix-tools, Linux, openSuSE, Power User, screen, SuSE Linux, tmux | Leave a Comment »

How do I disconnect all other users in tmux? – Stack Overflow

Posted by jpluimers on 2018/03/12

The joy of single character command-line switches, so thanks [WayBack] demure for answering at [WayBackHow do I disconnect all other users in tmux? – Stack Overflow:

You can use <prefix> D (where prefix is C-b by default), to chose which clients to detach; it will also list they col/lines as well as the last used time.

You could also use tmux’s detach-client option

 detach-client [-P] [-a] [-s target-session] [-t target-client]
               (alias: detach)
         Detach the current client if bound to a key, the client specified
         with -t, or all clients currently attached to the session speci-
         fied by -s.  The -a option kills all but the client given with
         -t.  If -P is given, send SIGHUP to the parent process of the
         client, typically causing it to exit.

either from <prefix>:followed by detach [options] or on the command line inside tmux with tmux detach [options]

–jeroen

Posted in *nix, *nix-tools, Power User, tmux | Leave a Comment »

The strange case of some applications not being able to copy/paste on the Mac OS X clipboard

Posted by jpluimers on 2017/07/19

I’ve not tracked down the cause yet, but these seem to be related:

  1. The Mac OS X build of Atom IO
  2. WinBox v 3.4 WineBottle version from Winbox for Mac in an embedded Wine environment – Joshaven.com
  3. pbcopy / pbpaste that allow command-line copy/pasting
  4. none of these being able to copy/paste any more and return error level 1 like terminal – pbcopy exits code 1, no error message – Ask Different but not even running tmux or screen which means this solution does not apply: ChrisJohnsen/tmux-MacOSX-pasteboard: Notes and workarounds for accessing the Mac OS X pasteboard in tmux sessions.
  5. I didn’t have Mouse Keys turned on
  6. Other applications (Chrome, FireFox, TextEdit, Finder, etc) still being able to copy/paste between each other

I’ve “fixed” 4. by doing this as recommended at osx – Copy and Cut sometimes don’t work – Ask Different:

launchctl list | grep com.apple.pboard

If the pboard daemon is running, then stop and start it. If it’s not running, start it:

launchctl stop com.apple.pboard
launchctl start com.apple.pboard

Now 4. works again if I restart each application, 6. still works, but these applications still cannot copy/paste to 1. 2. and 3.

What does work is a full reboot, but that takes a while (especially Chrome re-loading lots of Windows: I need to get more organised here).

It might be that I need to restart each application in 6.

Grrr…..

–jeroen

Posted in Apple, Atom, iMac, Internet, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MikroTik, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.9 Mavericks, Power User, Routers, Text Editors, tmux | 4 Comments »

tmux attach to named session or create when it doesn’t exist yet – via: How to start tmux with attach if a session exists – Unix & Linux Stack Exchange

Posted by jpluimers on 2016/11/16

In my alias list:

alias "tmux-attach-or-create-main-session=tmux new-session -A -s main"

Via User Wesley Baugh – Unix & Linux Stack Exchange who answered:

If naming your session is okay, then it’s easy to do with the new-session command:

tmux new-session -A -s main

where main is the session name that will be attached to or created if needed.

From man tmux

 The -A flag makes new-session behave like attach-session if session-name already exists; in this case, -D behaves like -d to attach-session.

–jeroen

Source: How to start tmux with attach if a session exists – Unix & Linux Stack Exchange

Posted in *nix, *nix-tools, Linux, openSuSE, Power User, SuSE Linux, tmux | Leave a Comment »

Capture tmux output – the much less painful way | Rico’s Tech Memo – copy full tmux buffer to file…

Posted by jpluimers on 2016/03/21

Simple steps to Capture tmux output – the much less painful way | Rico’s Tech Memo

Note the last line under 8) is a literal command: type it as such and it will save to that file.

–jeroen

Posted in *nix, *nix-tools, Power User, tmux | Leave a Comment »

 
%d bloggers like this: