LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-09-2013, 04:53 AM   #1
sudhanshu_t
LQ Newbie
 
Registered: Nov 2012
Location: India
Distribution: Linux
Posts: 5

Rep: Reputation: Disabled
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
 
Old 09-09-2013, 05:27 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by sudhanshu_t View Post
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?
 
1 members found this post helpful.
Old 09-09-2013, 11:17 AM   #3
sudhanshu_t
LQ Newbie
 
Registered: Nov 2012
Location: India
Distribution: Linux
Posts: 5

Original Poster
Rep: Reputation: Disabled
Smile

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
 
Old 09-09-2013, 11:26 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,689

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by sudhanshu_t View Post
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.
 
Old 09-09-2013, 11:53 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by sudhanshu_t View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xargs: unmatched single quote; by default quotes are special to xargs unless you use Raakh5 Linux - Newbie 7 05-21-2014 07:26 PM
Command line : xargs and rm Seb-o-tronic Linux - General 11 04-02-2013 10:32 PM
[SOLVED] basename with command substitions and xargs dugan Programming 3 06-21-2011 09:58 AM
[SOLVED] xargs cd is not working doru Linux - Newbie 14 03-23-2010 12:42 PM
clarification on find + xargs rm command dtra Linux - General 2 05-17-2006 05:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration