Visit a Url From Tmux

As I spend the majority of my day between any number of shell sessions, one of things I like to be able to do is quickly display all of the urls in my active pane in tmux.

urlview is a program that can help me with this.

If you are running osx and homebrew installing it is as simple as:

Install URL View -
brew install urlview

Once you have urlview installed you can give it a whirl as follows:

Programming Rocks-
echo "" | urlview

This will pop up a list prompting you to press the number of the link you want to visit:


Great, so now we know the basics of how urlview works, let’s tie it into tmux. Here is the tmux configuration line I use to tie it all together:

View Urls In tmux
bind-key u capture-pane \; save-buffer /tmp/active_tmux_buffer \; new-window -n urlview '$SHELL -c "urlview < /tmp/active_tmux_buffer && rm /tmp/active_tmux_buffer"'

When I press CTRL-b followed by u, it will do the following:

  • save the contents of my current buffer to a file named /tmp/active_tmux_buffer
  • open up a new tmux window and run the urlview utility with the previous saved file as the input
  • removes the temp file

Never get tired of using small tools that do one thing well and are composable with other tools!!

Develop With Passion®