concatenate compressed and uncompressed logs

2010-06-21 1 min read Bash Linux

<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/iwFUyltYgjM/concatenate-compressed-and-uncompressed-logs">concatenate compressed and uncompressed logs

$ find /var/log/apache2 -name 'access.loggz' -exec <a class="zem_slink freebase/en/gzip" title="Gzip" rel="homepage" href="http://www.gzip.org/">zcat {} ; -or -name 'access.log' -exec cat {} ; This command allows you to stream your log files, including gziped files, into one stream which can be piped to <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk or some other command for analysis.

Note: if your version of &#8217;find&#8217; supports it, use:

Continue reading

Linux command to repeat a string n times

2010-06-17 1 min read Bash

There are more than one situation where you wished that there was a simple way to print a character n number of times. At least I face that quite often, especially when you want to print a menu. I found this post today which has pretty good solution and also the way how it works :
<a href="http://superuser.com/questions/86340/linux-command-to-repeat-a-string-n-times">http://superuser.com/questions/86340/linux-command-to-repeat-a-string-n-times

\"Enhanced

Change pidgin status from the command line

2010-06-16 1 min read Bash Fedora Linux

$ purple-remote "setstatus?status=away&message=AFK" Thanks for the comment oshazard, i wasn&#8217;t aware of purple-remote existence.

  • <a href="http://www.commandlinefu.com/commands/view/4554/change-pidgin-status">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/unixApe">View all commands by <a href="http://feeds2.feedburner.com/commands/by/unixApe">unixApe

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/xmocNuFfObClC-QnA38odl3AWt8/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/xmocNuFfObClC-QnA38odl3AWt8/0/di" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/xmocNuFfObClC-QnA38odl3AWt8/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/xmocNuFfObClC-QnA38odl3AWt8/1/di" alt="" align="bottom" />

<img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/Ky02xAVnP7w" alt="" width="1" height="1" align="bottom" />

URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/Ky02xAVnP7w/change-pidgin-status">http://feedproxy.google.com/~r/Command-line-fu/~3/Ky02xAVnP7w/change-pidgin-status

List of commands you use most often

2010-06-16 1 min read Bash Learning

<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/6MxHiSiINdo/list-of-commands-you-use-most-often">List of commands you use most often

$ history | <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head > /tmp/cmds | gnuplot -persist <(echo 'plot "/tmp/cmds" using 1:xticlabels(2) with boxes') Plot your most used commands with gnuplot.

  • <a href="http://www.commandlinefu.com/commands/view/5845/list-of-commands-you-use-most-often">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/sthrs">View all commands by <a href="http://feeds2.feedburner.com/commands/by/sthrs">sthrs

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="commandlinefu.com" align="bottom" />

Continue reading

email with templates (with variables) from the command line with sendmail or any other MTA.

2010-06-09 2 min read Bash Fedora Linux

I was trying to get templates to work on evolution and found that although templates are there in evolution mail client, its not that efficient to use. What I thus wanted was to have something that could allow me to send mails to (and cc and bcc) to specified people with predefined template, only some values changed, like changelog and so on. So I wrote a set of files and below files to achieve the same. Hope it helps you too 🙂

Continue reading

Verify all the paths in the PATH directory

2010-06-08 1 min read Bash Learning Linux

Here is the command to test that all the directories in your path actually exist.

(<a class="zem_slink freebase/en/internal_field_separator" title="Internal field separator" rel="wikipedia" href="http://en.wikipedia.org/wiki/Internal_field_separator">IFS=:;for p in $PATH; do test -d $p || echo $p; done)

And the explanation :

Set the IFS to &#8221;:&#8221;

now we loop through the PATH variable

and test all the directories with &#8221;test -d&#8221;

Here is another version without IFS:

for i in ${PATH//:/ };do test  -d $i || echo $i;done

Continue reading
Older posts Newer posts