A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label buffer. Show all posts
Showing posts with label buffer. Show all posts

Select sub-section of putty buffer only

Are you sick and tired of waiting for your terminal to scroll down when dragging to select a large portion of the scrollback buffer in putty?

The putty developers already thought of that!


  1. Go to Putty Configuration window
  2. Choose "Selection" from category on the left of the window.
  3. Under 'Control use of mouse', choose 'Compromise (Middle extends, Right pastes)' if not already chosen.

(source)

STDERR and STDOUT appear in the wrong order when piping to a file

a Perl script - test.pl:

print "OUT 1\n";
print STDERR "ERR 2\n";
print "OUT 3\n";
print STDERR "ERR 4\n";
print "OUT 5\n";

Run the script, piping all output into a file:

perl test.pl &> file.log

cat file.log

ERR 2
ERR 4
OUT 1
OUT 3
OUT 5

Output is in the wrong order :(

Run it again using unbuffer:

unbuffer perl test.pl &> file.log

cat file.log

OUT 1
ERR 2
OUT 3
ERR 4
OUT 5

Output is in the correct order :)

(source)

Another way:

script -c 'perl ~/temp/stream.pl' file.log

cat file.log

(source)

vim tabs and buffers basics


in vim type  ":grep -Ri search_string *"
...it executes... press enter to get back to vim
then type ":copen" to open a window with the search results in
and you can browse the matches really easily

:help grep

then if you press enter to open one of the files found,
to get back to your original file type :buffers or :ls

:tabe #[number against file] will open the original file in a new tab
:sp #[number against file] will open the original file in a new window

:buffer [number against original file] will open the original file again
and you could make the F keys load the buffers

I prefer tabs over buffers because they're more visible
in bash vim -p file1 file2 will open 2 files in two different tabs
gt and gT will cycle through the files (I have that mapped to alt+left and alt+right)
:tabe will open a file in a new tab


Thanks Phill

xemacs buffer control

C-x b [buffer] [enter] - select or create a named buffer
C-x C-b - list existing buffers
C-x 1 - close the buffer list