Tuesday 6 September 2011

Useful UNIX Commands


1). To find the top 10 larger files in the Directory,
$ls -lrt | awk '{print $5,$9}' | sort -nr head | xargs ls -lrt
2) To find the access and Modification details of a file
$istat
*This command is available for AIX only
3).To remove file which are older then say 7 days
$find . -mtime +7 -exec rm {} \;
4). Locate Files that Contain Certain Strings
$ find . -print | xargs grep -i v\$dba_objects
5) To Delete top 10 huge files in directory,
Use,
$du -sk | sort -nr | head | awk '{print $2}' | xargs rm -r

No comments:

Post a Comment