1

I'm relatively new to working in the terminal, but I wondered if there was some way to report how many tabs I have open in my web browser. Using Mac OS 10.10, I would prefer Chrome or Firefox, but I am open to other browsers if it provides a solution.

dda
  • 6,030
  • 2
  • 25
  • 34

2 Answers2

0

You can use chrome-cli for this case.

Andi
  • 3
  • 4
0

You can use an AppleScript in the command line:

osascript -e "tell application \"Google Chrome\"" -e "set n to number of windows" -e "set ttl to 0" -e "set c to 0" -e "repeat n times" -e "set x to number of tabs of window c" -e "set ttl to ttl + x" -e "set c to c + 1" -e "end repeat" -e "return ttl" -e "end tell"

Just tested it now, it returns 73 for me :-)

dda
  • 6,030
  • 2
  • 25
  • 34