Rawr!!!

[PotW] bwm-hg

October 26th, 2010 by

little-throughput

I was pressed to figure out how much throughput was going over an interface for my laptop; a few minutes later I found this gem! It has one purpose, and it does it exceptionally well! Well I lie, it has a few purposes, but it’s main goal (and title) is to monitor bandwith [Band With Monitor - Next Generation]. Why would I want to monitor my bandwidth? Well for this usage case I wanted a simple method to view what kind of nfs throughput I was getting on my laptop. Bingo, I spent a little over a millisecond installing bwm-ng && was very happy to see exactly what I was looking for without having to do any special flags, or configuring the program, or anything. I quickly hit the ‘h’ to get a few little tidbits of greatness; like how to change the probe timeout, and other magical things. I love this little program and use it on all my machines now for quick throughput monitoring on my network/disks (ya, it does disks too ;)

Program: bwm-ng

Site Link: http://www.gropp.org/?id=projects&sub=bwm-ng

Download:

  1. Download direct: http://www.gropp.org/bwm-ng/bwm-ng-0.6.tar.gz
  2. Use CVS & get the newest version: svn co https://svn.sourceforge.net/svnroot/bwmng/trunk bwm-ng

Installation:

  1. Use your package manager (pacman -S bwm-ng for archlinux)
  2. Mac (download homebrew && sudo brew install tmux)
  3. Compile manually >>

Compile:


./configure

make -j8 (make with 8 jobs at once [compile faster on a core duo])

sudo make install

How to use:

First off execute `bwm-ng`, you will be greeted with your active interfaces. Shown will be TX (Transmit), RX (Receive) & Total && Total (of everything).

mac-ethernet

Right from the get go I hit the ‘h’ key for help, and quickly got acquainted with some powerful letters. ‘d’, ‘u’, ‘n’, ‘t’ are my favs *and are the heart of the application. I started out by changing the default value shown to “auto” with ‘d’, then I changed the type of output to “average” with the letter ‘t’. I was tickled pink that in less than 5 minutes I had what I needed, with no hassle what-so-ever. Some other glorious things that this program does is allow you to select how you would like to output the data (ncurses, ncurses2 (colors & stuff), plain (text), and html).

All of these features also apply to monitoring disks as well. Just punch the ‘n’ key a few times until disks show up…

If I haven’t expressed it already, I really like this program, and it’s one of the ones that I’ll be using regularly from now on (Until I find something better :)
Keybindings:


'h'  show this help
 'q'  exit
 '+'  increases timeout by 100ms
 '-'  decreases timeout by 100ms
 'd'  switch KB and auto assign Byte/KB/MB/GB
 'a'  cycle: show all interfaces, only those which are up,
only up and not hidden
 's'  sum hidden ifaces to total aswell or not
 'n'  cycle: input methods
'u'  cycle: bytes,bits,packets,errors
 't'  cycle: current rate, max, sum since start, average for last 30s

–help:

<strong>
</strong>

bwm-ng --help
Bandwidth Monitor NG (bwm-ng) v0.6
Copyright (C) 2004-2007 Volker Gropp <bwmng@gropp.org>
USAGE: bwm-ng [OPTION] ... [CONFIGFILE]
displays current ethernet interfaces stats

Options:
 -t, --timeout <msec>    displays stats every <msec> (1msec = 1/1000sec)
 default: 500
 -d, --dynamic [value]   show values dynamicly (Byte KB or MB)
 -a, --allif [mode]      where mode is one of:
 0=show only up (and selected) interfaces
 1=show all up interfaces (default)
 2=show all and down interfaces
 -I, --interfaces <list> show only interfaces in <list> (comma seperated), or
 if list is prefaced with % show all but interfaces
 in list
 -S, --sumhidden [value] count hidden interfaces for total
 -A, --avglength <sec>   sets the span of average stats (Default 30s)
 -D, --daemon [value]    fork into background and daemonize
 -h, --help              displays this help
 -V, --version           print version info

Input:
 -i, --input <method>    input method, one of: getifaddrs sysctl netstat ioservice

Output:
 -o, --output <method>   output method, one of:
 plain, curses, curses2, csv, html
 -u, --unit <value>      unit to show. one of bytes, bits, packets, errors
 -T, --type <value>      type of stats. one of rate, max, sum, avg
 -C, --csvchar <char>    delimiter for csv
 -F, --outfile <file>    output file for csv and html (default stdout)
 -R, --htmlrefresh <num> meta refresh for html output
 -H, --htmlheader        show <html> and <meta> frame for html output
 -c, --count <num>       number of query/output for plain & csv
 -N, --ansiout           disable ansi codes for plain output
 (ie 1 for one single output)

[PotW] tmux

October 13th, 2010 by

Tmux-Fire

It’s another Tuesday (errm almost tuesday — I got a little busy), and that means another PotW! This program is a little more useful than the last program. And makes living a mac more bearable (or any non tiling window manager for that matter) Tmux is the bees knees when it comes to console multi-tasking. It allows you to do a faux-tiling window manager with all your console apps, and the best part is that it’s cross platform. Just a little info about tmux: It stands for terminal multiplexer (cool name for multiplier), tmux is like screen’s pretty cousin, tmux is highly configurable, and a lot more stuff that I’ll have to split up in a few more posts. (this is just a primer, and yes I will talk about tmux more ;)

Program: tmux

Site Link: http://tmux.sourceforge.net

Download:

  1. Download direct: http://downloads.sourceforge.net/tmux/tmux-1.3.tar.gz
  2. Use CVS & get the newest version: CVS instructions for tmux

Installation:

  1. Use your package manager (pacman -S tmux for archlinux)
  2. Mac (download homebrew && sudo brew install tmux)

Compile:


./configure

make -j8 (make with 8 jobs at once [compile faster on a core duo])

sudo make install

How to use:

Lets start with the basics. Fire up tmux, and lets learn how to get some, errrm, help!

  1. man tmux (best resource, and well documented)
  2. ^b ? (Ctrl-?) [Press Ctrl-b, then ?] (will show commands with short descriptions)

Lets start with some basics:

  • make a new vertical pane: ^b % (Carat ‘^’ means Ctrl)
  • make a new horizontal pane: ^b “
  • make a new window: ^b c
  • rename window: ^b ,
  • move around: ^b (use arrow keys)

Now that you know your way around, lets have some fun:

  • Find test in an open window: ^b f (this one tickles me pink, it’s so kewl that you can search for *anything*, and it will auto-move to the terminal your thinking of)
  • enter copy mode to copy text in buffer: ^b [
  • paste the text you've copied: ^b ]
  • what time is it?: ^b t
  • swap panes around: ^b { (previous pane) and } (next pane)

Screenshots:

Layout 1Layout 2Layout 3Layout 4Layout 5window-naming

Default Bindings (all the things you can do):

The default command key bindings are:

C-b         Send the prefix key (C-b) through to the application.
C-o         Rotate the panes in the current window forwards.
C-z         Suspend the tmux client.
!           Break the current pane out of the window.
"           Split the current pane into two, top and bottom.
#           List all paste buffers.
%           Split the current pane into two, left and right.
&           Kill the current window.
'           Prompt for a window index to select.
,           Rename the current window.
-           Delete the most recently copied buffer of text.
.           Prompt for an index to move the current window.
0 to 9      Select windows 0 to 9.
:           Enter the tmux command prompt.
=           Choose which buffer to paste interactively from a list.
?           List all key bindings.
D           Choose a client to detach.
[           Enter copy mode to copy text or view the history.
]           Paste the most recently copied buffer of text.
c           Create a new window.
d           Detach the current client.
f           Prompt to search for text in open windows.
i           Display some information about the current window.
l           Move to the previously selected window.
n           Change to the next window.
o           Select the next pane in the current window.
p           Change to the previous window.
q           Briefly display pane indexes.
r           Force redraw of the attached client.
s           Select a new session for the attached client interactively.
t           Show the time.
w           Choose the current window interactively.
x           Kill the current pane.
{           Swap the current pane with the previous pane.
}           Swap the current pane with the next pane.
~           Show previous messages from tmux, if any.
Page Up     Enter copy mode and scroll one page up.
Up, Down
Left, Right
Change to the pane above, below, to the left, or to the right of the current pane.
M-1 to M-5  Arrange panes in one of the five preset layouts: even-horizontal, even-vertical, main-horizontal, main-vertical, or tiled.
M-n         Move to the next window with a bell or activity marker.
M-o         Rotate the panes in the current window backwards.
M-p         Move to the previous window with a bell or activity marker.
C-Up, C-Down
C-Left, C-Right
Resize the current pane in steps of one cell.
M-Up, M-Down
M-Left, M-Right
Resize the current pane in steps of five cells.

[PotW] tty-clock

October 5th, 2010 by

tty-clock_small

Lets give a big shout out for today’s Program of the Week (tty-clock). Just thought I would start a Tuesday snippet for my blog called Program of the Week. I plan to highlight fun, useful, unheard-of (and heard-of alike) software that people should hear about. Since this is the first PotW I’ll start out with one of my new favorites; ttyclock has geek written all over it. It’s got just enough options to wet your timely appetite, while staying cool about resources. It uses almost no resources to be exact (a fraction of a cpu cycle to run), which makes it a perfect candidate to integrate into conky (linux), or geektool (for mac). Or if you’re the type that likes tiling-window managers (such as dwm) you could flag it as a floating window on all your desktops to get a little creative. Other that that it’s a run of the mill clock, it tells time, which is great. But it also supports 8 colors (shown below), can tell 12/24 hour time, and can center itself in your terminal, just to name off some of it’s strong points. Download links are below, along with compile instructions (for people that aren’t fortunate enough to have tty-clock in your repos), and some screenshots append this post. Enjoy, and happy time telling!

Program: tty-clock

Site Link: http://github.com/xorg62/tty-clock

Download:

  1. ‘git clone http://github.com/xorg62/tty-clock.git’
  2. download the branch master tarball/zip

Installation:

  1. use your package manager (yaourt -S tty-clock for archlinux)
  2. download ^^ & compile from source >>

Compile:

make
sudo make install
tty-clock

Use it!:

usage : tty-clock [-sctrvih] [-C [0-7]] [-f format]
<pre>    -s            Show seconds
    -c            Set the clock at the center of the terminal
    -C [0-7]      Set the clock color
    -t            Set the hour in 12h format
    -r            Do rebound the clock
    -f format     Set the date format
    -v            Show tty-clock version
    -i            Show some info about tty-clock
    -h            Show this page

Screenshots:

tty-clock