=====File Manipulation===== ===Find Large files=== This finds the 10 largest files in the /var directory. Modify as needed # du -a /var | sort -n -r | head -n 10 ===Copy files from host1 to host2 via host3=== # ssh vmbulkmsgtst1 -- tar cz /admin/software/ | ssh bulkmsg1 -- tar vxzC / ===List files with info=== Command for getting the list of files with perms, owners, groups info. Useful to find the checksum of 2 machines/images. # find / | sort | xargs ls -ld | awk '{print $1,$3,$4,$9,$10,$11}' ===tar large number of files=== If there's too many files in a dir to tar up normally # find . -type f -exec tar -uf /disk3/mqueue.tar {} \; ===Move large number of files=== Move files one by one; handy if there's too many files to do anything else with. # for FILE in `ls /var/spool/mqueue/`; do mv /var/spool/mqueue/$FILE /var/spool/mqueue.TODAY ; done & # for FILE in `ls /disk3/mqueue/`; do mv /disk3/mqueue/$FILE /disk3/mqueue.TODAY ; done & ===Relocate file=== Relocate a file or directory, but keep it accessible on the old location through a simlink. # mv $1 $2 && ln -s $2/$(basename $1) $(dirname $1) ===Remote diff files=== Diff files on two remote hosts. # diff <(ssh mymeteor01 cat /etc/hosts) <(ssh mymeteor02 cat /etc/hosts) === emove DOS Characters with VIM=== :set ff=unix And in case you want to migrate back to, err.. MS-DOS: ":set ff=dos" does the opposite. ===Remove DOS Characters with TR=== # tr -d "\015" < myscript.sh > myscriptNEW.sh # mv myscriptNEW.sh myscript.sh ===Remove DOS Characters with DOS2UNIX=== # man dos2unix