LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-26-2012, 09:41 PM   #1
drpartha
LQ Newbie
 
Registered: Apr 2012
Location: Secunderabad, India
Distribution: Suse, Ubuntu
Posts: 6

Rep: Reputation: Disabled
Using xargs


Using xargs

I have a directory full of gpg encrypted files (all file names end with .gpg). I would like to decrypt all these files. The command "gpg filename" helps me do this one file at a time. I would like to scan all the files and decrypt in one go. I tired the one line scripts::
find . -name "*.gpg" | xargs gpg
OR
find . -name "*.gpg" -print0 | xargs -0 gpg

Both of these dont work. What is the way to do this ?

Cany anyone give me a clue please ? Please email me directly.

Many thanks,

partha
drpartha@gmail.com
 
Old 10-27-2012, 07:17 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,617

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Have you tried....

You could read the man pages for the utilities involved, there are about a dozen related ways of doing this.

Also, it is much neater if you use the tags for quote and code.

You tried
Code:
 find . -name "*.gpg" | xargs gpg
I believe. Why not try
Code:
 find . -name "*.gpg" -exec gpg {} \;
and see how that works: this takes the extra calls to xargs right out of the problem. Xargs is of little advantage here, since you have to execute an event for each file anyway: it really shines when you can make one call to process multiple targets.
 
Old 10-27-2012, 09:28 AM   #3
drpartha
LQ Newbie
 
Registered: Apr 2012
Location: Secunderabad, India
Distribution: Suse, Ubuntu
Posts: 6

Original Poster
Rep: Reputation: Disabled
find . -name "*.gpg" -exec gpg {} \;

That works, but for each file I have to type the passphrase again and again. This could be a pain if I have too many files to decrypt. Can anyone suggest a way out / Can we make gpg use the same passphrase again without asking ?
 
Old 10-27-2012, 10:39 AM   #4
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
What about running a gpg-agent?

Last edited by Reuti; 10-27-2012 at 10:41 AM. Reason: Added link
 
Old 10-27-2012, 11:32 AM   #5
drpartha
LQ Newbie
 
Registered: Apr 2012
Location: Secunderabad, India
Distribution: Suse, Ubuntu
Posts: 6

Original Poster
Rep: Reputation: Disabled
Not so easy. But I found a way out. Will announce the details soon through the web.

Thanks,

partha
 
  


Reply

Tags
bash, gpg, xargs



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
Using xargs SBN Linux - General 2 04-07-2008 07:44 PM
Xargs -i problems. Glaurung Linux - Software 2 10-25-2007 03:23 AM
`wc`, `xargs` h/w Programming 11 09-30-2007 04:22 PM
xargs yawe_frek Linux - Software 1 04-15-2007 04:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:19 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