LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   xargs command not working with ssh (https://www.linuxquestions.org/questions/linux-server-73/xargs-command-not-working-with-ssh-4175476459/)

sudhanshu_t 09-09-2013 04:53 AM

xargs command not working with ssh
 
Hello,

I have 2 node host, and I was to run few command from 1st node to 2nd node with the help of xargs command.

when I run the below command I get error:

ssh localhost find /opt -type f -size +5M -mtime +5 -ls |egrep -i log |awk '{print $NF}' |xargs du -sh
du: cannot access **************

its happening with "|xargs gzip "

Requesting you to please look into this and do the needful.

Regards,
Sudhanshu

druuna 09-09-2013 05:27 AM

Quote:

Originally Posted by sudhanshu_t (Post 5024533)
when I run the below command I get error:

ssh localhost find /opt -type f -size +5M -mtime +5 -ls |egrep -i log |awk '{print $NF}' |xargs du -sh
du: cannot access **************

The command used is to elaborate. This part:
Code:

find /opt -type f -size +5M -mtime +5 -ls |egrep -i log |awk '{print $NF}' |xargs du -sh
can be simplefied to:
Code:

find /opt -type f -size 51M -mtime +5 -iname "*log" -exec du -sh {} \;
Using ssh localhost .... also doesn't make sense. Why use ssh to log into the machine you are working on?

If this is just an example, have a look at the following for the complete picture:
Code:

ssh localhost "find /opt -type f -size +5M -mtime +5 -iname '*log' -exec du -sh {} \;"
Mind the quoting!

Quote:

Originally Posted by sudhanshu_t
its happening with "|xargs gzip "

This doesn't seem related to the above, can you explain where this is used/needed?

sudhanshu_t 09-09-2013 11:17 AM

Hi Druuna,

thank you very much.. I really appreciate your help. updated command has solved my problem.
I have few more more that require you assistance to fix.

please provide me with your IM id.

Thanks,
Sudhanshu

TB0ne 09-09-2013 11:26 AM

Quote:

Originally Posted by sudhanshu_t (Post 5024699)
Hi Druuna,
thank you very much.. I really appreciate your help. updated command has solved my problem.
I have few more more that require you assistance to fix.

please provide me with your IM id.

Sorry, that's not the way things work. This is a COMMUNITY forum...if you have questions, post them here so everyone can learn from the answers. We're not here to provide you with free, personalized, one-on-one tech support.

druuna 09-09-2013 11:53 AM

Quote:

Originally Posted by sudhanshu_t (Post 5024699)
Hi Druuna,

thank you very much.. I really appreciate your help. updated command has solved my problem.
I have few more more that require you assistance to fix.

please provide me with your IM id.

Nope, I won't.

I'm willing to answer questions here at LQ if I have the time. I will not do one-on-one stuff, no exceptions.

TB0ne already answered, but I just wanted to make sure that you understand that this isn't "just" his opinion.


All times are GMT -5. The time now is 04:09 PM.