0

I installed ag on localhost and then localhost has access to remote host, I don't want to install ag on remote host, instead I'd like to use ag from localhost to run against files in remote host.

I'm thinking some kind of proxy ag command or run ag command on ssh but still prefer 'stable` and permenant solution.

Is that possible?

Tuyen Pham
  • 300
  • 3
  • 14
  • How come ag command will run in the remote host if the ag is not installed? Even if you do the ssh ag is needed or else you can go with find command if the remote host has it. – danglingpointer Aug 16 '18 at 07:34
  • Make sense, but I'm trying to clone all files and folders and run against them in `localhost` that keep remote intact. – Tuyen Pham Aug 16 '18 at 07:45
  • 2
    Welcome on the StackOverflow! Note, your question is not really about programming, it is more like about Linux. I suggest to re-post your question on the https://unix.stackexchange.com . – peterh Aug 16 '18 at 19:44

1 Answers1

0

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.

gregory
  • 10,969
  • 2
  • 30
  • 42