FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-29-2010, 05:41 AM
Andrei Popescu
 
Default find+grep

On Mi, 28 iul 10, 16:10:38, Jordon Bedwell wrote:
> On 7/28/10 4:03 PM, Jordan Metzmeier wrote:
> >On 07/28/2010 04:11 PM, Jordon Bedwell wrote:
> >>
> >>find / |grep libraptor
> >
> >Perhaps you wanted find's -name option? find / -name 'libraptor*'
>
> I personally prefer to grep over find, but to each their own :P as
> each have their own methods to do things that ultimately lead to the
> same solution.

Assuming very long output of find, grepping over it is not efficient.
Besides, the file you search might be quite early found and one can
interrupt the search, while with your approach one has to wait until
both find and finish.

Regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
 
Old 07-29-2010, 06:04 AM
Andrei Popescu
 
Default find+grep

On Jo, 29 iul 10, 08:41:57, Andrei Popescu wrote:
> On Mi, 28 iul 10, 16:10:38, Jordon Bedwell wrote:
> > On 7/28/10 4:03 PM, Jordan Metzmeier wrote:
> > >On 07/28/2010 04:11 PM, Jordon Bedwell wrote:
> > >>
> > >>find / |grep libraptor
> > >
> > >Perhaps you wanted find's -name option? find / -name 'libraptor*'
> >
> > I personally prefer to grep over find, but to each their own :P as
> > each have their own methods to do things that ultimately lead to the
> > same solution.
>
> Assuming very long output of find, grepping over it is not efficient.
> Besides, the file you search might be quite early found and one can
> interrupt the search, while with your approach one has to wait until
> both find and finish.
grep----------^^^

Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
 
Old 07-29-2010, 09:50 AM
Tzafrir Cohen
 
Default find+grep

On Thu, Jul 29, 2010 at 08:41:57AM +0300, Andrei Popescu wrote:
> On Mi, 28 iul 10, 16:10:38, Jordon Bedwell wrote:
> > On 7/28/10 4:03 PM, Jordan Metzmeier wrote:
> > >On 07/28/2010 04:11 PM, Jordon Bedwell wrote:
> > >>
> > >>find / |grep libraptor
> > >
> > >Perhaps you wanted find's -name option? find / -name 'libraptor*'
> >
> > I personally prefer to grep over find, but to each their own :P as
> > each have their own methods to do things that ultimately lead to the
> > same solution.
>
> Assuming very long output of find, grepping over it is not efficient.
> Besides, the file you search might be quite early found and one can
> interrupt the search, while with your approach one has to wait until
> both find and finish.

If you stop it with ctrl-C, both find and grep get interrupted and stop,
right?

--
Tzafrir Cohen | tzafrir@jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@cohens.org.il | | best
tzafrir@debian.org | | friend


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100729095032.GV17569@pear.tzafrir.org.il">http://lists.debian.org/20100729095032.GV17569@pear.tzafrir.org.il
 
Old 07-29-2010, 09:57 AM
Andrei Popescu
 
Default find+grep

On Jo, 29 iul 10, 09:50:32, Tzafrir Cohen wrote:
>
> If you stop it with ctrl-C, both find and grep get interrupted and stop,
> right?

Actually I don't know how shell pipes work here. Is the output of find
piped to grep only when find finishes or as soon as there is some
output?

Regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
 
Old 07-29-2010, 10:08 AM
Jordon Bedwell
 
Default find+grep

On 7/29/10 4:57 AM, Andrei Popescu wrote:

On Jo, 29 iul 10, 09:50:32, Tzafrir Cohen wrote:


If you stop it with ctrl-C, both find and grep get interrupted and stop,
right?


Actually I don't know how shell pipes work here. Is the output of find
piped to grep only when find finishes or as soon as there is some
output?

Regards,
Andrei


As soon as there is an output (which is always immediately) so think of
each iteration of find as being piped to grep, you don't lose *much*
efficiency but you do lose *some*, efficiency is subjective here since
it's CPU time you lose. So if you do a find on root "var and home" would
an iteration (like normal), except instead of staying inside of find
it's piped to grep for each iteration, this is where you lose *some* CPU
time, but you gain a lot more power. You can exit out of the find using
CTRL+C though as somebody did point out CTRL+C is the universal knock
your shit off hot-key for terminals.


I opt to pipe to grep because I usually do a lot more complicated things
with find and over time, I just kept using grep, it's a personal
preference really. Just like using locate is far faster than using find
and find -name is slower and so forth on down the line. I've never been
a big fan of locate though because it can miss on some machines with
horrible i/o.



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4C51531B.6040907@envygeeks.com">http://lists.debian.org/4C51531B.6040907@envygeeks.com
 
Old 07-29-2010, 10:37 AM
Andrei Popescu
 
Default find+grep

On Jo, 29 iul 10, 05:08:27, Jordon Bedwell wrote:

[snip]

Thanks, learned some new stuff.

Regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
 
Old 07-29-2010, 12:38 PM
Jordan Metzmeier
 
Default find+grep

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 07/29/2010 06:08 AM, Jordon Bedwell wrote:
>
> I opt to pipe to grep because I usually do a lot more complicated things
> with find and over time, I just kept using grep, it's a personal
> preference really. Just like using locate is far faster than using find
> and find -name is slower and so forth on down the line. I've never been
> a big fan of locate though because it can miss on some machines with
> horrible i/o.

For me it something that I just cringe to see. I realize that in
practice, it is not bad. I just cannot get over feeling uneasy when
seeing things like:

find | grep
cat | grep
ls -l | grep
for i in $(ls -l foo/)
sudo su

I realize that all of it can be used to accomplish a task. So why do I
hate to see it so much?

- --
Jordan Metzmeier

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCAAGBQJMUXYnAAoJEKj/C3qNthmTwS8P/1pNyVI9DD8llA95oAvQ+7ig
mr64j52Ovd7763Jg6J1Wk7BroGQ+Gc/9ipsijmeDoJ6wAO6S/1uX7NnwXMBU48eb
vyZxVroCbfEvDp7cX0LF7wMS4FJk+FxlWdo75+AAekBO2pGFg7 ynov0D4elfN35V
fz/+zNoBvXyZS3LIVx9Idy6d0YLFyVURMbHy6YEuxvWOHxhxoBvvJ WR+USCiIk8R
aNIljPxNKi0yjJsk9GTZmSVVSDCaofgbu2xAT01WHkoV2F8VTx AMrt7WSwQRsHBN
TeLDjd/4nSztjHie4lDnKA72V23r+SXvl/mzY+SwZEbrWa9i09QoaeQn1rmpd2W0
x3hH56iYzPTJyn5OJWDdNa0awMtcUJ0e96KF80jAjv6tR8gZqu NHObC0/UHaizf1
EdzNBrMh6qCiR8vl2+cidTW967wh2d36frwnU0lCJGx4S71bz1 DZt4LLWAO9utMq
CxovXNu+677ENBTDyNcvzBis8BhvU1VYtg0MAaDwCq5hBwhGwE 7bwsw0uAe9D25k
+4dGDYe3g1qz+C4Jwbo2ralOTOVkuDqiDDr3qy6tlMZORo3twG w+zeQrDfGIK4QC
iZ09HYNAmf6ye75PNR3jFys+aSAW6j2KHs/rgWILBmIlhbA3RVbMdKTRYe/kHMdB
Cy0ClzXvX9I5W+rfmcAH
=5Hfr
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4C517628.1010708@gmail.com">http://lists.debian.org/4C517628.1010708@gmail.com
 
Old 07-29-2010, 04:22 PM
"Boyd Stephen Smith Jr."
 
Default find+grep

On Thursday 29 July 2010 07:38:00 Jordan Metzmeier wrote:
> For me it something that I just cringe to see. I realize that in
> practice, it is not bad. I just cannot get over feeling uneasy when
> seeing things like:
>
> find | grep
> cat | grep
> ls -l | grep
> for i in $(ls -l foo/)
> sudo su
>
> I realize that all of it can be used to accomplish a task. So why do I
> hate to see it so much?

I understand your issues with all but the last one. A user may need to "sudo
su" due to configuration outside of their control. A system that requires you
to "sudo su" for some task is likely misconfigured, but it is a useful tool to
have around, as a user.

The rest are less useful, and generally imply a limited, incomplete, or flawed
understanding of one or more of the tools you are using.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@iguanasuicide.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/
 
Old 07-29-2010, 04:25 PM
Eduardo M KALINOWSKI
 
Default find+grep

On Qui, 29 Jul 2010, "Boyd Stephen Smith Jr." wrote:

I understand your issues with all but the last one. A user may need to "sudo
su" due to configuration outside of their control. A system that
requires you
to "sudo su" for some task is likely misconfigured, but it is a
useful tool to

have around, as a user.


sudo -i




--
The optimist thinks that this is the best of all possible worlds,
and the pessimist knows it.
-- J. Robert Oppenheimer, "Bulletin of Atomic Scientists"

Eduardo M KALINOWSKI
eduardo@kalinowski.com.br


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 20100729132551.89225ubuopeo64cg@mail.kalinowski.co m.br">http://lists.debian.org/20100729132551.89225ubuopeo64cg@mail.kalinowski.co m.br
 
Old 07-29-2010, 04:31 PM
Jordan Metzmeier
 
Default find+grep

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 07/29/2010 12:22 PM, Boyd Stephen Smith Jr. wrote:
>
> I understand your issues with all but the last one. A user may need
> to "sudo su" due to configuration outside of their control. A system
> that requires you to "sudo su" for some task is likely misconfigured,
> but it is a useful tool to have around, as a user.
>
> The rest are less useful, and generally imply a limited, incomplete,
> or flawed understanding of one or more of the tools you are using.

I no longer configure my machines in a way that it allows a user to gain
full root via sudo. However, when I did, I found "sudo -i" to be more
appropriate than "sudo su" which seems to be more like "su -l". Of
course, you could always do "sudo su -l".

- From the manpage:

- -i The -i (simulate initial login) option runs the shell specified in
the passwd(5) entry of the user that the command is being run as.
The command name argument given to the shell begins with a ‘-’ to
tell the shell to run as a login shell. sudo attempts to change to
that user’s home directory before running the shell. It also ini‐
tializes the environment, leaving TERM unchanged, setting HOME,
SHELL, USER, LOGNAME, and PATH, and unsetting all other environment
variables. Note that because the shell to use is determined before
the sudoers file is parsed, a runas_default setting in sudoers will
specify the user to run the shell as but will not affect which
shell is actually run.

- --
Jordan Metzmeier

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCAAGBQJMUazIAAoJEKj/C3qNthmTW7EQANHKUy7UW/YWxax3W5Z6C9nF
T+0JP2a79FlwaQABCP3+0CLWlk4QGB+Oa9UqnttQP6SjE5dLz8 oA27tJO2NQTAe+
/ZeiFFnAF3jAOlG7BTDxl4QolPJgqZ6cOkp8qcRSdOJdFDrvmk0 NeF9JszRl8Amn
5LqnI0M8GVRvsdutDn50bEyi4LO3rLKsSEQuZNYl45tVRFjFB9 ZgaAuINbj4FDF/
yya3NMT11B1ApSzwAWg1HZ8myTxIklJxJc3Hk/gfBsmdhfLtI0egxY4q5yJ7iuvx
Q1mOFef2zrvT9l2fnxyplHCbMlgugwvAiTgZE9YBr3U1NGo85j CNVLjY9r2auh5+
hnz+uWflwi4y0bDiUiQnzJvnlM80NImyblyiqhY1FiOu7/D+Q94dWfhUEGcXxN+M
rApuz+CCYjoHIxMV28nOIxtIYhlmXRnLjKh2OTTDzZqQXOdYKa xBS+k5l4n+jjfm
LbZqlpAuOlXncgPn1BiB81f3nbthPsdGeCi14PF/5HjgqGpdOyy7lN14WOyWbzPO
ny7UbY/knlJy+bdwFUQNMzXkpuEW57dB60KuAPlaoAf4VVCHME2nl7XJu lwcM3Pw
LTiM5phh4XrzPvEifzWI8fQhLbccCweHNy0tGbyaLlDwizbgzN Ts0aojuYZSiWi7
L7L+ToFAZ1QSOLwcPEXY
=9EEK
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4C51ACC9.3010901@gmail.com">http://lists.debian.org/4C51ACC9.3010901@gmail.com
 

Thread Tools




All times are GMT. The time now is 04:43 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org