cool sed/grep magic to convert output to csv format
I generallly keep doing this a lot, so thought will share with you. Lets assume we are capturing free ouput every min/hour/or whatever. The output looks like this:
Time: Mon Jan 21 23:59:10 AEDT 2019
——————-total used free shared buff/cache available
Mem: 32014 8656 1735 1697 21621 21308
Swap: 51195 75 51120
then we can use some grep and sed to convert this to something like this:
Mon Jan 21 23:59:10 AEDT 2019,32014,8656,1735,1697,21621,21308
Continue reading
speedtest cli
To test your speed you can use speetest-cli. Here is the description:
Command line interface for testing internet bandwidth using speedtest.net
and to install and test:
sudo yum install speedtest-cli #Run speedtest-cli
The output is like below:
][1]CLI Color and bash prompt.. some colored fun with prompts in bash
There are two ways to do it, one is with tput command. We will see that some other time, today we will consider the escape sequence way.
First we need to understand the colors as understood by bash. Some time back a fried of mine gave me this little script to find the colors. You can download it <a href="http://blog.amit-agarwal.co.in/2009/03/bash_colors" target="_blank">Script bash colors. Here is the script
#!/bin/bash
T=’amit agarwal’ # The test text
Continue reading
Upload a video to youtube
<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/JXJj-wy4keA/upload-a-video-to-youtube">Upload a video to youtube
|
1
|
Google just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a youtube video but there are plenty more google services to interact with.
Continue readingconcatenate compressed and uncompressed logs
<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 ’find’ supports it, use:
Continue readingemail with templates (with variables) from the command line with sendmail or any other MTA.
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