The short answer is no, there's no way to run ag
or for that matter grep
, ack
, etc. with some built-in proxy mode on a remote machine. And, this makes sense if you consider that these utilities are designed to scan the contents of large sets of files -- going over the network would be too slow.
There are other options: (1) copy the files you want to search to localhost
and search them or (2) mount a remote drive on remote host
. The first option is more common; and, there are a suite of unix tools to facilitate copying and syncing files between two machines. The classic one being rsync
: e.g. rsync -a -essh . username@remotehost:~/remoteDirectoryToSync
. (3) While the may seem obvious, the final option is just using the tools on the remote machine. Almost every linux/Unix box has grep
or find
, and learning and refining one's skill with these default tools pays dividends.