cksum – compare for multiple files.

2013-04-30 1 min read Fedora Learning Linux
If you have to compare cksum for couple of files, the you know how cumbersome it is. So, I wrote a simple script, wherein you can create a file called cksums in the current directory and copy paste the result of “**cksums ***” into this file, and then run this script. Cool 🙂 #!/bin/bash - #=============================================================================== # # FILE: # # USAGE: ./ # # DESCRIPTION: Compare cksums of multiple files. Continue reading

Using file partially for filenames

2012-02-12 1 min read bash Learning
There are some commands that take file name and there are some case where you need to give file name. But there are some cases where you want to modify the file before passing it to the command. What do you do in these case’s? I had a file containing huge amount of data and for some testing I wanted to pass only the first few lines of the file and not the complete file. Continue reading

function for copy files with progress bar (using pv – pipe viewer)

2010-11-11 1 min read bash Linux
function for copy files with progress bar (using pv – pipe viewer) 1 <td> <div class="text codecolorer"> &nbsp;cp_p() { if [ `echo "$2" | grep ".*/$"` ]; then pv "$1" > "$2""$1"; else pv "$1" > "$2"/"$1"; fi; } </div> </td> </tr> dont have to type new file name (it copy file under same name) and dont have to use ‘/’ in the end of destination folder (but you can if u want, its idiot proof) Continue reading

Downloading all related videos from youtube with youtube-dl

2010-05-16 2 min read Fedora Learning Linux Uncategorized
How many time did you want to see all the videos (related) to the one you were watching on youtube but decided otherwise as the downloaded was not fast enough. Or has it happened to you that you wanted to <a class="zem_slink freebase/en/uploading_and_downloading" title="Uploading and downloading" rel="wikipedia" href="">download all the related videos, in either case you can use the youtube-dl utility I blogged about some times back. First you need to get all the <a class="zem_slink freebase/en/uniform_resource_locator" title="Uniform Resource Locator" rel="wikipedia" href="http://en. Continue reading

Linux find command – Find file and directories faster and easier

2010-03-16 1 min read Linux
This command is very powerfull when used with combination of filters and pipes and RE. I will give some example: find . -type f –» List all files find . -type f -exec rm {} <a class=“zem_slink” title=“Path (computing)” href=“" rel=“wikipedia”>\; –» Delete all files find . -type d -exec rm {} \; –» Will through some common errors 🙂 find . -name "name" –> find files containing name in the filename Continue reading

prepend to a file with sponge from moreutils

2010-03-16 1 min read Linux
<a href="">A few weeks I wrote about a tool, which helps you easily prepend to a file. I submitted prepend to moreutils and Joey was kind enough to point out this could be done with `sponge&#8217;.? sponge reads standard input and when done, writes it to a file: Probably the most general …<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="">Automating Tasks in Linux Using Crontab ( <li class="zemanta-article-ul-li"><a href="http://www. Continue reading

Perl script to create csv files with a pattern – Generic script.

2010-01-19 1 min read Learning Linux perl
I was having a really bad day and needed a quick solution to create some csv files. And this I needed to do for multiple data kinds and patterns, so I created this small script to do the job for me… #Number of rows required in the output. $rows = 100; #The config and the output file open (CF_FILE, &#8221;<Config.test&#8221;); open (OUT_FILE, &#8221;>test.csv&#8221;); #————————————————————————— # No need to change anything below this. Continue reading