Wednesday, May 29, 2013

Recursively list all files in a directory Linux



find -follow -type f   à find all files recursively type file

ll –R  à long list recursively

ls –LR à List all recursively

tree –l  à tree structure  

find /dir -type f -follow -print| xargs ls –l   à file and list all files

Friday, May 24, 2013

Find and move list of file spread over diffrent location on a linux machine


#----------------------------------------------------------------#
#  USES : sh fileFinderMover.sh <filewithfilenames> <targetpath> #
#----------------------------------------------------------------#

#!bin/sh
for i in `cat $1`
do
path=`locate $i`
mv $path $2
echo $path
done



This script will seach for the file which give as list and will move to target location.

Wednesday, May 22, 2013

hadoop oiv : hadoop offline image viewer, get a list of all files on hadoop


Replace a word in file Linux Shell

sed -i 's/<word to replace>/<new word>/g'<filenametobereplacedin>

Eg:

sed -i 's/shashwat/shriparv/g'shashwat.txt

Better way to get a list of all files on Hadoop, using shell.





Hadoop provides an option OIV  that is offline image viewer, which can read the Hadoop image file and output it to a output file in human readable format.


Syntax and uses:


bin/hadoop  oiv –i <Hadoop image file name> -o <output file in human readable form>


Options with this command:


There is an additional option to output file format that is defined using switch –p <format>, the formats can be: -->
 

Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...