Usefull Linux Commands

Here are bunch of usefull linux commands.

i) Remove files by last updated date.
This will remove the files older than the "ctime" arg, in the current directory.
(note this is an interview question)
find  -ctime +17 -daystart -exec rm "{}" \;
 
Command to Delete files created on a particular day:
---------------------------------------------------------------
 
# touch -t 1104160000 /tmp/begin
# touch -t 1104172359 /tmp/end
# cd <- folder where your files are ->
# find . -xdev -type f -newer /tmp/begin -a ! -newer /tmp/end | xargs rm 
 
 
Find number of open files in system
------------------------------
lsof | perl -lane '$x{"$F[0]:$F[1]"}++;END { print
"$x{$_}\t$_" for sort {$x{$a}<=>$x{$b}} keys %x}'

( Will be updated soon with more ...)

No comments:

Post a Comment

Kindly make your valuable and progressive comments here.
Junks will be deleted without notice :-)

  Find below few useful scripts for  Performance  Management:: # Important MOS notes for TRACING: There are several ways to trace a particul...