inotify -watch for file to change

2014-01-28 1 min read Learning Linux
Here is a simple command for you. It uses inotify tools. So first you need to install : sudo yum install inotify-tools and then you can try something like this: while true; do inotifywait -r -e modify --exclude=".swp" . && make; done Here, once the file changes, we are running make, but you can do anything you want. Related articles Development Server: Automatic Reload on Code Change Concurrent or lock access in bash script function

Delete all but some directories

2013-08-16 1 min read bash Fedora Linux
I think, like me, you would have faced a lot of situations, where you wanted to delete all the files or directories in a location, leaving only the required files/directories. So, I have a directory containing lots of files/directories and I want to delete most of them except some 5/10 of them, how to I do it. I finally wrote a small script to do that. First save list of files that you do not want to delete in file called “listnames” and then execute the below script. Continue reading

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: checkcksums.sh # # USAGE: ./checkcksums.sh # # DESCRIPTION: Compare cksums of multiple files. Continue reading

duff – find duplicate files.

2013-03-19 1 min read Fedora
duff – description: Description : Duff is a command-line utility for quickly finding d AURA Console (Photo credit: jameswatts.solfenix) uplicates in a given set of files and now time to execute : find . -type f -print0|duff -e0|xargs -0 This will print a list of duplicate files. If you directly want to delete them then you can use them in a rm command directly like :: rm $(find . -type f -print0|duff -e0) Related articles How can I duplicate the terminal in a file Getting rid of Open With duplicates FYI: Vatican Holocaust Files (Gordon Duff) . Continue reading

vim mappings for multiple files.

2012-08-06 1 min read Vim Tips
If you open multiple files in vim with command line option. Then the only way to move between the files is “:n” and “:N”. There is a easier way to do this. Just add mappings for this in vimrc. Here is what you can use. map :N map :n And if you want to make sure that you move to the prev or next file after saving the file, then you modifyt the mapping like this: Continue reading

rpmconf – Tool to handle rpmsave and rpmnew files

2012-06-18 1 min read bash Fedora
Install the utility: sudo yum install rpmconf Description: Description : This tool search for .rpmnew, .rpmsave and .rpmorig files and ask you what to do with them: Keep current version, place back old version, watch the diff or merge. And finally run the utility: sudo rpmconf -a and if there is a conflict or rpmsave or rpmnew file, then you will see something like this: Configuration file `/etc/default/grub’ -rw-r–r– 1 root root 354 Mar 16 22:49 /etc/default/grub. Continue reading

symlinks -delete all invalid soft links in Linux/Fedora

2012-06-12 1 min read bash Fedora Linux
First of all, install symlinks if it is not installed : sudo yum install symlinks and here is the description: Description : The symlinks utility performs maintenance on symbolic links. Symlinks checks for symlink problems, including dangling symlinks which point to nonexistent files. Symlinks can also automatically convert absolute symlinks to relative symlinks. Install the symlinks package if you need a program for maintaining symlinks on your system. and the help for the same: Continue reading
Older posts