Command line goodies

Here are some command line tidbits that i use regularly and find to be very handy, hopefully you will too.

Create a list of files in a directory and all its subdirectories
find [path] -type f > [output file]
example for listing all files in the directory source:
find source -type f > files.txt

Monitor cpu usage
top -F -ocpu -s 5 -n 5

Update Modification Date Recursively
find {dir} -exec touch {} \;

backup a directory
rsync -av –delete [src] [dest]

search through your command line history
history | grep -i “search string”
this will output a list of history commands by history number that match your search, then use the history number to run that command again
![history number]

remove all .svn directories
find ./ -name “.svn” | xargs rm -Rf

Leave a Reply