Find file modified 5 or fewer days ago
find . -mtime -5 -iname '*.pdf'
# Change mode of all files and directories (see also chmod_tree)
find . -type d -print -exec chmod 755 {} \;
find . -type f -print -exec chmod 664 {} \;
# Move selected files to single folder:
#
mkdir dmv
find . -iname '*dmv*' > dmv.find
vi dmv.find
cat dmv.find | xargs -I '{}' mv -iv '{}' dmv
# Create a tar with symlinks and referenced files used by KWord
#
ldd /usr/bin/kword > kword.deps
cat kword.deps | xargs tar cvf kword.deps.tar # symlink
cat kword.deps | xargs tar rhvf kword.deps.tar # files ref'd by simlink.
tar rvf /usr/bin/kword
# find examples
# Find .c files in .zip files (post clean up is needed)
#
find floppy/out -iname '*.zip' -print -exec zipinfo '{}' '*.c' \; 1> c.lst 2> /dev/null
# Find .c files in .tgz files
#
find . -iname '*.tgz' | xargs -tI {} tar ztf {} | grep '\.c$'
# xargs examples:
# Display all lines in found .c files that have the "continue" statement:
#
find . -iname '*.c' | xargs grep continue
# This does the same thing as the last example except it feeds grep the
# file names one at a time instead of all of them at one time. Some programs
# only support one file at time and some may need the file name argument
# somewhere besides at the end. The "-I pattern" argument defines what
# pattern to look for after the command name.
find . -iname '*.html' | xargs -I {} grep -H file {}
# Find a string ("zero" in the example) in all files of a certain type:
file * | grep Bourne | sed 's/:.*//' | xargs grep -i zero
# Print 25% of the lines in ~edwards/sl/io/pesc.c
l="expr `wc -l pesc.c | tr -cd [:digit:]` / 4" ; head -n `$l` pesc.c
# Disk Activity
#
lsof - List Open Files
nmon - Monitor disk usage and everything else
iotop - Like top with disk io - Needs Python 2 and kernel certain kernel attributes
# Get a stalled print queue going again:
#
lpc restart {printer-name}
# Install with:
#
rpm -Uv --replacepkgs --replacefiles *
# Nice bash shell prompt:
#
PS1='\h:\w\$ '
# Bootstrap a network interface: # ifconfig eth0 192.168.1.6 netmask 255.255.255.0