[CentOS] grep contents of file on remote server

Les Mikesell lesmikesell at gmail.com
Fri Sep 24 14:08:26 EDT 2010


On 9/24/2010 12:50 PM, Tim Dunphy wrote:
> Hello,
>
>   I am attempting to grep the contents of a key file I have SCP'd to a
> remote server. I am able to cat it:
>
> [code]
> [bluethundr at LBSD2:~]$:ssh root at sum1 grep `cat /root/id_rsa.pub`

Put single quotes around the whole command you want to send to the 
remote.  Otherwise your local shell is going to process the backtick 
expansion before anything else.  And grep is just as capable of reading 
the file as cat anyway.

-- 
   Les Mikesell
    lesmikesell at gmail.com





More information about the CentOS mailing list