Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
tips:threelinestip [2009/05/25 00:34]
127.0.0.1 external edit
tips:threelinestip [2012/12/01 18:13]
a [Create static mirror of dynamic web site (ex. Wordpress)]
Line 146: Line 146:
     -density 300 -quality 80 $file `echo $file | sed 's/\.pdf$/\.jpg/'`; done     -density 300 -quality 80 $file `echo $file | sed 's/\.pdf$/\.jpg/'`; done
  
 +===== rename upper to lowercase in bash ====
  
 +   for x in *.JPG; do y=$(echo $x | tr '[A-Z]' '[a-z]'); echo $y; mv $x $y; done
 +===== Find duplicate files in Linux =====
  
 +Let’s say you have a folder with 5000 MP3 files you want to check for duplicates. Or a directory containing thousands of EPUB files, all with different names but you have a hunch some of them might be duplicates. You can cd your way in the console up to that particular folder and then do a
  
 +<code>
 +find -not -empty -type f -printf “%s\n” | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
 +</code>
  
 +This will output a list of files that are duplicates, according tot their HASH signature.
 +Another way is to install fdupes and do a
 +
 +   fdupes -r ./folder > duplicates_list.txt
 +
 +The -r is for recursivity. Check the duplicates_list.txt afterwards in a text editor for a list of duplicate files.
 +
 +===== Linux - Top 10 CPU-hungry apps =====
 +
 +   ps -eo pcpu,pid,args | sort -k 1 -r | head -10
 +
 +===== Create static mirror of dynamic web site (ex. Wordpress) =====
 +
 +
 +   wget --mirror -w 2 -p -r -np --html-extension --convert-links -R xmlrpc.php,trackback <URL>
 +   
 +===== Find processes utilizing high memory in human readable format ======
 +
 +   ps -eo size,pid,user,command | sort -rn | head -5 | awk '{ hr[1024^2]="GB"; hr[1024]="MB"; for (x=1024^3; x>=1024; x/=1024) { if ($1>=x) { printf ("%-6.2f %s ", $1/x, hr[x]); break } } } { printf ("%-6s %-10s ", $2, $3) } { for ( x=4 ; x<=NF ; x++ ) { printf ("%s ",$x) } print ("\n") }'
tips/threelinestip.txt · Last modified: 2015/01/07 07:47 by mrizvic
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready