Sunday·06·October·2013
Searching in Screen’s copy mode //at 23:43 //by abe
I’m using GNU Screen daily for definitely more than a decade and I became maintainer of Debian’s screen package nearly exactly two years ago. Nevertheless it still happens occassionally that I discover features yet unknown to me. Recently I had one of these moments again:
I looked for a specific line in the long output of a command which has run
inside a Screen session. For that I entered Screen’s copy mode with
Ctrl-A [
and scrolled around with arrow keys and page-up
and -down keys.
But didn’t find it. I thought, it would be cool if I can search for
the string I’m looking for. Intuïtively I typed /
,
the search string and pressed enter. And it worked! It jumped to the
next occurrence of that string.
Of course I immediately had to check if tmux has such a feature, too. And it indeed has, but it seems to be a less sophisticated implementation:
Feature | Key-binding in GNU Screen | Key-binding in Tmux |
---|---|---|
Switch into copy/scroll mode (needed for the remainder) |
Ctrl-A [ |
Ctrl-B [ |
Search for string once, forward | / + string + Enter |
Ctrl-S + string + Enter |
Search for string once, backward | ? + string + Enter |
Ctrl-R + string + Enter |
Search for string again, forward | / Enter |
Ctrl-S Enter |
Search for string again, backward | ? Enter |
Ctrl-R Enter |
Incremental search for string, forward | Ctrl-S + string |
- |
Incremental search for string, backward | Ctrl-R + string |
- |
(Incremental) search for next occurrence, forward | Ctrl-S again |
- |
(Incremental) search for next occurrence, backward | Ctrl-R again |
- |
Being able to do incremental search like with GNU Emacs gave me yet
another reason for continuing to use Screen and not to switch Tmux.
;-)
Tagged as: copy mode, feature, GNU Screen, screen, search, tmux
// show without comments // write a comment
Related stories
Monday·20·February·2012
Git Snapshot of GNU Screen in Debian Experimental //at 01:09 //by abe
I just uploaded a snapshot of GNU Screen to Debian Experimental. The package (4.1.0~20110819git450e8f3-1) is based on upstream’s HEAD whose most recent commit currently dates to the 19th of August 2011.
While the upload fixes tons of bugs which accumulated over the past two years in Debian’s, Ubuntu’s and upstream’s bug tracker, I don’t yet regard it as suitable for the next stable release (and hence for Debian Unstable) since there’s one not so nice issue about it:
- #644788: screen 4.1.0 can’t attach to a running/detached screen 4.0.3 session
Nevertheless it fixes a lot of open issues (of which the oldest is a wishlist bug report dating back to 1998 :-) and I didn’t want to withhold it from the rest of the Debian community so I uploaded it to Debian Experimental.
Issues closed in Debian Experimental
- #25096: digraph table should be run-time configurable
- #152961: lacks tsl/fsl/dsl caps
- #176626: mini-curses type of interface for screen -r w/ multiple screens? (Fixed by suggesting iselect, screenie or byobu)
- #223320: does not switch mouse mode
- #344759: mishandles xterm control string to set window title
- #353090: please enable the built-in telnet
- #361274: cannot reattach to sessionname if there is another session with similar sessionname
- #450421: please raise MAXWIN to at least 100 (merged with #499273)
- #461107: Requires test -t 0 even when opening a new window on existing screen
- #481411: window created with ‘-d -m’ silently ignores ‘-X exec’
- #488619: Session name string escape
- #496750: screen -d -m and -D -m segfault if setenv given with no value in a configuration file
- #532240: screen with caption SEGVs when resized to 1 line tall
- #541793: “C-a h” (mis)documented twice
- #558724: breaks altscreen
- #560231: Please remove restriction on user/login name length
- #578729: outputs spaces when refreshing/attaching a window with “defbce on”
- #591624: segfault when running “screen -d -m” with “layout save default” in .screenrc
- #603009: Updating the screen Uploaders list
- #612990: /etc/init.d/screen-cleanup: should check for existence of screen binary
- #621704: Fix slow scrolling in vertical splits
- #630535: manpage typo
- #641867: version bump (this bug report sparked the upload :-)
Update: Issues also closed in Debian Experimental, but not (yet) mentioned in the Debian changelog
- #238535: screen lock can no more be bypassed by reattaching.
- #446082: Shows cursor in front of the selected window in “windowlist -b”.
- #522689: Passes signals to programs running inside screen on kfreebsd.
- #526002: Adds focus left/right commands.
- #611453: Documents vertical split in man-page.
- #621804 and #630976: Allows longer $TERM than 20 characters
Issues which will be closed in Ubuntu
- #183849: update to git version of screen
- #315237: crashes with certain options and terminal sizes
- #582153: doesn’t accept login names longer than 20 chars
- #588846: slow when using vertical split
- #702094: Copying and pasting from mutt includes many trailing spaces
- #786292: segfaults if using layout saving with “-D -m”
- #788670: segfault in screen/byobu in natty
Please test the version from Experimental
If you are affected by one of the issues mentioned above, please try the version from Debian Experimental and check if they’re resolved for you, too.
Thanks to all who contributed!
A lot of the fixes have been made or applied upstream by Sadrul Habib Chowdhury who also industriously tagged Debian bug reports as “fixed-upstream”. Thanks!
Thanks also to Brian P Kroth who gave the initial spark to this upload by packaging Fedora 15’s git snapshot for Debian and filing bug although the upload is based on the current HEAD version of GNU Screen as this fixes some more important issues than the snapshot Fedora 15 includes. That way also two patches from Fedora/RedHat’s screen package are included in this upload.
(Co-) Maintainer wanted!
Oh, and if you care about the state of GNU Screen in Debian, I’d really appreciate if you’d join in and contribute to our collab-maint git repository – there are still a lot of issues unresolved and I know that I won’t be able to fix all of them myself. And since Hessophanes unfortunately currently has not enough time for the package, we definitely need more people maintaining this package.
P.S.
Yes, I know about tmux and tried to get some of my setups
working with it, too. But I still prefer screen over tmux.
:-)
Tagged as: byobu, Debian, Experimental, git, GNU, GNU Screen, iselect, screen, screenie, snapshot, tmux, Ubuntu, upload
// show without comments // write a comment
Related stories
Tuesday·30·August·2011
Useful but Unknown Unix Tools: watch //at 22:18 //by abe
Yet another useful tool of which at least I heard quite late in my Unix career is “watch”. For a long time I wrote one-liners like this to monitor the output of a command:
while :; do echo -n "`date` "; host bla nameserver; sleep 2; done
But it’s way shorter and less error-prone to use “watch” from Debian’s procps package and just write
watch host bla nameserver
The only relevant difference is that I don’t have some kind of history when the output of the command changed, e.g. to calculate the rate with which a file grows.
You can even track the output of more than one command:
watch 'ps aux | grep resize2fs; df -hl'
Also a nice way to use watch is to run it inside GNU Screen (or tmux or splitvt) and split up the terminal horizontally, i.e. show the output of watch in one window and the process you’re tracking with the commands run by watch in the other window and see both running at the same time.
Update, Sunday, 28th of August 2011, 17:13h
I never found a useful case for watch’s -d
option which
highlights changes to the previous run (by inverting the changed
bytes), but until now three people pointed out the -d
option in response to this blog-posting and weasel also had some nice
examples, so here are they:
Keep an eye on the current network routes (once per second) of a host and quickly notice when they change:
watch -n1 -d ip r
Watch the current directory for size or time stamp changes of its files:
watch -d ls -l
The option -d
only highlights changes from the previous run to the
next run. If you want to see all bytes which ever changed since the
first run, use --differences=cumulative
.
Thanks to Klaus “Mowgli” Ethgen, Ulrich “mru” Dangel, Uli “youam”
Martens and Peter “weasel” Palfrader for comments and suggestions.
Tagged as: GNU Screen, nuggets, procps, screen, splitvt, tmux, UUUT, watch
// show without comments // write a comment