This is interesting and important when doing more things on the command line or 'by hand', and more important on 'old slow' systems that many of us grew up with than today.
I remember being concerned about how much room in fixed memory that file descriptors used, or I/O buffer size, or how to programmatically cache data to keep from having to re-read data. Is anyone interested on that level other than embedded system programmers anymore? Discussion? ><> ... Jack ---------- Forwarded message ---------- From: Unix Guru Universe <[email protected]> Date: Sun, Aug 4, 2013 at 2:34 AM Subject: Unix Tip: EFFICIENT COMMANDS =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= UNIX GURU UNIVERSE UNIX HOT TIP Unix Tip 3464 - August 4, 2013 http://www.ugu.com/sui/ugu/show?tip.today =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= EFFICIENT COMMANDS I cringe anytime I see someone code inefficiently. Here are three of the most common mistakes, followed by a better way to do the same thing. Bad: cat somefile | grep something Better: grep something somefile Why: You're running one program (grep) instead of two (cat and grep). Bad: ps -ef | grep something | grep -v grep Better: ps -ef | grep [s]omething Why: You're running two commands (grep) instead of three (ps and two greps). Bad: cat /dev/null > somefile Better: > somefile Why: You're running a command (cat) with I/O redirection, instead of just redirection. Although the bad way will have the same result, the good way is far faster. This may seem trivial, but the benefits will really show when dealing with large files or loops. Regards. This tip generously supported by: [email protected] -------------------------------------------------------------------------- To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today -- -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en --- You received this message because you are subscribed to the Google Groups "NLUG" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
