MacOS/UNIX tip of the day: Opening many urls at once

Bildschirmfoto 2025-03-13 um 16.28.32

Today I needed to use a tool to look up information about 30 or so blogs at work. The tool is a web-based internal tool, which accepts a blog_id as a parameter in the url. I used some UNIX magic to extract these from some other information, so that I had a simple list in my terminal. Instead of clicking on each one, I decided to try to find an easier route, and indeed, I found one right away. I have my iTerm2 terminal configured to copy on highlight, which means I simply highlighted the urls in the terminal. Then I used the handy pbpaste command on MacOS (other OSes have something similar, I believe Cygwin is getclip, on Linux you can use xclip and xsel). MacOS also has a handy command called open, which automatically decides which application to use depending on the type of argument. If you give it a url, it will open with your default browser (which for me is Firefox). In order to do this for all the urls in one fell swoop, I used the xargs command, which passes all the arguments to one command. Thus my command looked like

pbpaste | xargs open

All of the urls started opening in parallel in separate tabs, and then I was able to quickly go through each one and get the information I needed.

Join 165 other subscribers

archives

  • 2025 (5)
  • 2024 (10)
  • 2023 (8)
  • 2022 (15)
  • 2021 (19)
  • 2020 (1)
  • 2019 (1)
  • 2018 (2)
  • 2017 (1)
  • 2016 (2)
  • 2015 (5)
  • 2014 (5)
  • 2013 (2)
  • 2011 (7)
  • 2010 (10)
  • 2009 (50)
  • 2008 (28)
  • 2007 (31)
  • 2006 (8)

Category