This is a simple way of using the real time json format feed from the Port Authority Trans-Hudson (PATH) rail system to get a list of when the next trains are arriving per station.
This gist uses both curl and jq, which are typically pre-installed on most computers.
curl -s https://www.panynj.gov/bin/portauthority/ridepath.json | \
jq -r \
--arg STATION "HOB" \
'.results[] | select (.consideredStation == $STATION) | .destinations[] | .messages[] | (.arrivalTimeMessage | (" " * (8 - length)) +.) + " => " + .headSign'
STATION
can be any of these three letter abbreviations:
"09S" = 9th Street
"14S" = 14th Street
"23S" = 23rd Street
"33S" = 33rd Street
"CHR" = Christopher Street
"EXP" = Exchange Place
"GRV" = Grove Street
"HAR" = Harrison
"HOB" = Hoboken
"JSQ" = Journal Square
"NEW" = Newport
"NWK" = Newark
"WTC" = World Trade Center
The above command shows all the trains arriving at the designated station, when they're expected, and which line/direction they're running:
2 min => Journal Square via Hoboken
22 min => Journal Square via Hoboken
Delayed => 33rd Street via Hoboken
13 min => 33rd Street
For a slightly more visual web app that can be run locally or as a containerized image, see my ridepath-app.